The difference between serif and Sans-serif fonts
On the computer screen, Sans-serif fonts are considered easier to read than serif fonts
CSS Font
In CSS, there are two types of font family names:
Universal Font Family-a combination of font systems with similar skins (such as "Serif" or "monospace")
Specific font family-a specific font family (such as "Times" or "Courier")
Font family
The Font-family property sets the font family for the text.
The Font-family property should set several font names as a "fallback" mechanism, and if the browser does not support the first font, he will try the next font.
Note: If the name of the font family is more than one word, it must be in quotation marks, such as font Family: "Arial".
Multiple font families are indicated by a comma-delimited:
Instance
P{font-family: "Times New Roman", Times, serif;}
For more commonly used font combinations, check out our web-safe font mix.
Font style
is primarily used to specify font style properties for italic text.
This property has a value of three:
Normal-Normal display text
Italic-text displayed in italics
Italic text-text tilts sideways (very similar to italic, but not very supported)
Instance
p.normal {font-style:normal;} p.italic {font-style:italic;} P.oblique {font-style:oblique;}
Font size
The Font-size property sets the size of the text.
The ability to manage the size of text is very important in web design. However, you can't make a paragraph look like a caption by resizing the font, or make the title look like a paragraph.
Be sure to use the correct HTML tags for
The value of the font size can be either absolute or relative size.
Absolute size:
Sets a specified size of text
Do not allow users to change the size of text in all browsers
Absolute size is useful when determining the physical size of the output
Relative size:
To set the size relative to the surrounding elements
Allows the user to change the text size in the browser
If you do not specify a font size, the default size is 16 pixels (16px=1em), just like normal text paragraphs.
Set Font size pixels
Sets the size and pixels of the text, giving you complete control over the text size:
Instance
h1 {font-size:40px;} h2 {font-size:30px;} p {font-size:14px;}
The example above can be used to resize text in Internet Explorer 9, Firefox, Chrome, Opera, and Safari.
Note: The above instance cannot be run in a previous version of IE9.
Although the size of the text can be resized through the browser's zoom tool, this adjustment is the entire page, not just the text
Use EM to set the font size
To avoid problems with text that cannot be adjusted in Internet Explorer, many developers use EM units instead of pixels.
EM size units are recommended by the consortium.
1em is equal to the current font size. The default text size in the browser is 16px.
Therefore, the default size of 1em is 16px. You can convert pixels to em:px/16=em by the following formula
Instance
h1 {font-size:2.5em;}/* 40px/16=2.5em */h2 {font-size:1.875em;}/* 30px/16=1.875em */p {font-size:0.875em;}/* 14px/16=0 .875em */
In the above example, the text size of EM is the same as the pixels in the previous example. However, if you use EM units, you can adjust the text size in all browsers.
Unfortunately, it's still an Internet Explorer problem. When you resize the text, it is larger or smaller than the normal size.
Use percent and EM combinations
In the solution for all browsers, the default font size for settings <body> elements is percent:
Instance
body {font-size:100%;} h1 {font-size:2.5em;} h2 {font-size:1.875em;} p {font-size:0.875em;}
Our code is very effective. In all browsers, you can display the same text size and allow all browsers to scale the size of the text.
"Recommended"
1. Special recommendation : "PHP Programmer Toolkit" V0.1 version download
2. Free CSS Online video tutorial
3. php.cn Lonely Nine-base (2)-css video tutorial