Home > Web Front-end > HTML Tutorial > HTML/CSS from scratch-common attributes (3)

HTML/CSS from scratch-common attributes (3)

WBOY
Release: 2016-10-17 09:11:22
Original
983 people have browsed it

1. css text attributes

(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

{color: rbg250,250,250/#000000/red;}

(3)Text font{font-family:"Font 1","Font 2","Font 3";}

The browser interprets it according to the font

Note: When the font name is in Chinese, add double quotes: "Microsoft Yahei"; a single English word does not need to be added: Arial; if there are spaces in English, add quotes: "Times New Romen";

(4) Font bold {font-weight:;}


Attribute values: normal/500 (regular); bold/600-900 (bold); bolder (bolder);

(5)Text tilt

{font-style:itatic (italic)/oblique (oblique)/normal (cancel italic)}

(6) Horizontal alignment

{text-align:left/center/right/justify (justify both ends);}

(7)Vertical alignment

{vertical-align:top/bottom/middle;}

(8) Text line height

{line-height:normal/value;}

Measure line height: from the top of this line of text to the top of the next line of text; Single line of text: when line height = container height, vertically centered; when line height < container height Vertically upward;

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)}

Extension: Add strikethrough

(10) First line indent


{text-indent:value;}
Value is the number of words. The unit is: em;

Text-indent is a negative value and goes forward

It only works on the first line of text

(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) Pictures as list symbols

{list-style-image:url();}

(3) Define list symbol position

{list-style-position:ouside/inside;}

(4)Remove list symbols

{list-style:none;}

4. Background attributes

(1) Background color {background-color: value;}

(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);}

(4) Background image fixed {background-attachment: scroll (scroll)/fixed (fixed);} (5) Background image position {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;}

                      {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

(3) png: loss of images with less color, not Support animation, support transparency, it is fireworks;

Note: It requires high storage of png, higher requirement of storing gif, use gif when compatible;

6. Floating (arrange vertical elements 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 div{overflow:hidden;}

to the parent element in css.

Seven, box model

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;}


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template