CSS Font


CSS font attributes

CSS syntax consists of selector, attribute and value, the font is one of the most important attributes of CSS.

The CSS Font property allows you to set the font-family and font-weight, font-size, font-style (such as italics) and font-transformation (such as small caps).


CSS font size

The "font-size" attribute is used to set the font size, which may be as follows:

Value Description
Numerical The length value | percentage, consisting of a floating-point number and a unit identifier, can not be negative. The percentage value is based on the size of the font in the parent object
xx-small Absolute font size, according to the object font to adjust, the minimum
x-small Absolute font size, based on the object font to adjust, smaller
small Absolute font size, according to the object font to adjust, small
medium Default, absolute font size, according to the object font to adjust, normal
large Absolute font size, according to the object font to adjust, large
x-large Absolute font size, based on the object font to adjust, larger
xx-large Absolute font size, based on the object font to adjust, the maximum
larger Relative font size, relative to the parent object font size, use the em unit
smaller Relative font size, relative to the parent font size, use the em unit
Example
p { font-size: xx-large; } 
p { font-size: 12px; } 
p { font-size: 20%; } 

CSS Font Name

The "font-family" attribute is used to set the font names, in order of precedence, separated by commas, and should be enclosed in quotation marks if the font name contains spaces.

html { font-family: Courier, "Courier New", sans-serif; }

CSS font style

The "font-style" property is used to set the font style. Possible values ​​are :

Value Description
normal Default, normal font
italic Italic (for special fonts that do not have italic variables, will use the oblique)
oblique Tilt the font
inherit Specifies that the font style should be inherited from the parent element

CSS font thickness

The "font-weight" attribute is used to set the font weight. Possible values ​​are :

Value Description
normal Default, normal font. Equivalent to 400. Declaring this value will cancel any previous settings
bold Bold, equivalent to 700, is equivalent to the <b></b> tag
bolder Bolder than bold
lighter lighter than normal
100 The font is at least as thin as 200
200 The font is at least as thick as 100, as thin as 300.
300 The font is at least as thick as 200, as thin as 400
400 Equivalent to normal /td>
500 The font is at least as thick as the 400, as thin as 600
600 At least as thick as 500 fonts, as 700 as fine
700 Equivalent to bold
800 The font is at least as thick as 700, as thin as 900
900 Font at least as thick as 800
inherit Specifies that the weight of the font should be inherited from the parent element



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook