IT Band of Brothers HTML5 CSS3 Tutorial Secret common CSS style attributes and values 1

b60b6d3b0b22455c8bb784a3ec4e4f5b.jpg

 

Style properties in CSS are more frequently used such property can be divided into several categories: font, text, background, location, borders, lists, and other style attributes. Each class attributes may be used alone; if used with a plurality of class attributes, they can also be integrated to solve the row.

 

1 font attributes

You can set the font by font family property division, change the font size and style, you can also adjust the font bold, and make the font deformation. All modified font attributes, and values ​​described in Table 6-1.

Table 1 CSS in a modified font attributes

 

212a39fe2e6d4d5a8dbe27631d27f794.png

 

 They were used in Table 1 for each font style attribute class, designated HTML paragraph element p in Bold font (in bold), Italic (italics), or serif font Times 12 point size. Code as follows:

a6f9a05b10ef4cfe94bcf34bbf279013.jpg

This example uses a plurality of font attribute setting paragraphs class font style, we can be reduced to one line of code to solve. Font by the font class attributes can be done, syntax is as follows:

font:? [<font style> || <font distortion> || <bold font>] <font size> [/ <row height>] <font family>?

Font properties font is used as shorthand different font properties, especially high line. Allowed values ​​are optional, if there are a plurality of attribute values, with spaces between them separately. For example, the example code may be rewritten as:

p {font: italic bold 12px / 14px Times, serif} / * all font attributes to resolve a row * /

The segment is designated Bold (bold) and Italic (italic) Times or serif font, size 12 pixels, 14 pixels of the line height, font attributes, and the same effects as before are set values.

 

2 color attributes

Color property allows authors to specify the color of an element, you can use color to set the text color attribute in the CSS. To avoid conflicts with user style sheets, background and color properties should always be specified together. Some examples of color rules as follows:

6d9250e2a41640708a50965c1aaaab97.jpg

Guess you like

Origin www.cnblogs.com/itxdl/p/11756662.html