HTML/CSS from scratch - common attributes
1. CSS text attributes
(1) Text size {font-size:value;}
Unit: pt:9pt=12px; browser default font size is 16px
em:1em=16px;
In CSS2.0 medium
xx-small:9px
x-small:11px
small:13px
medium:16px
large:19px
)Font color
Note: The font name is In Chinese, add double quotes: "Microsoft Yahei"; single English words do not need to be added: Arial; if there are spaces in English, add quotes: "Times New Romen";
(4) Font bold {font-weight:;}
Single line of text : When line height = container height, vertically centered; when line height
Description: font abbreviation order: font-style font-weight font-size/line-height font-family; 16px "Microsoft Yahei";}
(9) Text decoration
{text-decoration:none/underline (underline)/overline (underline)/line-through (add strikethrough)}
Extension:
Add and delete The first line of line
(10) is indented{text-indent:value;}
Text-indent is a negative value and goes back
Only for the first line of text It works(11) Word spacing
{letter-spacing:value;}
Control the distance between English letters and Chinese characters
Extension: {word-break: break-all;}=
Line break
2. Border
{border-top/bottom/right/left:1px solid/dotted/dashed/double;}
3. CSS list properties
(1) List symbol style
{list-style-type:disc (solid circle) /circle(hollow circle)/squrare(hollow square width)/none(remove list symbol);}
{list-style-type:none} is equivalent to {list-style;none;}
(2) Picture as a list Symbol
{list-style-image:url();}
(3) Define the list symbol position
{list-style-position:ouside/inside;}
(4) Remove the list symbol
{list -style:none;}
IV. Background attributes
(1) Background color {background-color:value;}
(2) Background image {background-image:url(path);}
(3) Background image Tile {background-repeat: no-repeat (non-tile)/repeat (tile)/repeat-x (horizontal tile)/repeat-y (vertical tile);}
(4) Background image fixed {background-attachment :scroll(scroll)/fixed(fixed);}
(5) Background-position:x y(value: 50px 50px; direction: right bottom;)}
The direction positions are: horizontal (left/center/right ) Vertical (top/center/bottom)
(6) Abbreviation: {background:url() no-repeat center top fixed #f00;}
5. Commonly used image formats on web pages
(1) jpg: lossy compression loses quality and is suitable for images with rich colors
(2) gif: lossy compression loses color and supports transparency, animation is suitable for images with fewer colors (3) png : The loss of pictures has less color, does not support animation, supports transparency, and is fireworks;
Note: high requirements for png storage, higher requirements for gif storage, use gif when compatible;
6. Floating (let vertical elements be arranged horizontally)
{float:left/right/none}
(1) Clear float {clear:left/right/both;}Explanation: The element after floating is out of the document flow and is suspended above. When you float the element in front When the element is an element in the standard flow (without floating)
The position of the element after floating depends on the browser, and the non-floating elements behind the floating element will squeeze into the original position of the floating element.
(2) Solve the height collapse
Height collapse: The resulting condition is that the parent element does not write the height, and the child element floats;
Solution: (1) Add an empty
at the end of the floating element, write a statement div{clear:both;}
(2) Add a statement to the parent element in css, div{overflow:hidden;}
7. Box model
1. Definition: Web page element How to display and relate to each other.
Border boundary Filler content area
2, padding (padding)
(1) Padding: padding is the distance between the content of an element in an element on the set page and the edge (border) of the element, padding;
(2 ) is used to adjust the positional relationship of the content in the container
(3) is used to adjust the position of the child element in the parent element
(4) the padding attribute is added to the parent element
Regarding the issue of whether the padding value should be reduced or not?
1. Subtraction: The parent element has width and height
2. No reduction: The parent element has no width and height;
(5) How to reduce?
Height - (top+bottom); Width - (left+right);
3. Syntax:
Four values: {padding: top right bottom left;}
One value: {padding: 20px}={padding:20px 20px 20px 20px;}
Two values: {padding: 20px 30px;}={padding: 20px 30px 20px 30px;}
Two values: {padding: 20px 30px 40px;}={padding: 20px 30px 40px 30px;}
Split: {padding-top/right/bottom/left:value;}
2. Margin
(1) Margin: margin is the blank area outside the element in the setting page;
(2) The margin attribute is added to the child Above the level element
(3) Syntax:
Four values: {margin: top right bottom left;}
One value: {margin: 20px}={padding:20px 20px 20px 20px;}
Two values: {margin: 20px 30px;}={padding: 20px 30px 20px 30px;}
Two values: {margin: 20px 30px 40px;}={padding: 20px 30px 40px 30px;}
Split: {margin-top/right/bottom/ left:value;}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...
