Home >Web Front-end >HTML Tutorial >HTML/CSS from scratch-common attributes (3)
(1) Text size {font-size:value;}
Unit: pt:9pt=12px; browser default font size is 16px
em: 1em=16px; medium:16px
large:19px
x-large:23px
xx-large:27px
(2)Font color
The browser interprets it according to the font
{font-style:itatic (italic)/oblique (oblique)/normal (cancel italic)}
{text-align:left/center/right/justify (justify both ends);}
{vertical-align:top/bottom/middle;}
{line-height:normal/value;}
Description: font abbreviation order: font-style font-weight font-size/line-height font-family;
(9) Text modification
{text-decoration:none/underline(underline)/overline(underline)/line-through(add strikethrough)}
{text-indent:value;}
Value is the number of words. The unit is: em;
{letter-spacing:value;}
Control the distance between English letters and Chinese characters
{border-top/bottom/right/left:1px solid/dotted/dashed/double;}
(1) List symbol style
{list-style-image:url();}
(2) Background image {background-image: url (path);}
(3) Background image tile {background-repeat: no-repeat (not tile )/repeat (tile)/repeat-x (horizontal tile)/repeat-y (vertical tile);} {background:url() no-repeat center top 100px #f00 scroll;}
5. Commonly used image formats on web pages
(1) jpg: lossy compression loss of quality is suitable for images with rich colors
(2) gif: lossy compression loss of color supports transparency, animation is suitable for images with less color
{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
1. Definition: How web page elements are displayed and their relationship with each other.
Border Border Filler Content Area
2. padding
(1) padding: padding is used to set the distance between the content of an element and the edge (border) of the element in an element on the page, padding;
(2) is used to adjust the content in the container The positional relationship in
(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 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;}