CSS font

CSS Font

CSS font properties define font, bold, size, and text style.

CSS Fonts

In CSS, there are two types of font family names:

Universal font families - font systems with a similar appearance Combination (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 of the text.

The font-family property should set several font names as a "fallback" mechanism, 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 character, it must be in quotation marks, such as Font Family: "宋体".

Font style

is mainly used to specify the font style attribute of italic text.

This attribute has three values:

Normal - displays the text normally

Italic - displays the text in italics

Slanted text - displays the text to one side Italic (very similar to italic, but less supported)

Font size

##The font-size property sets the size of the text.

The ability to manage text size is very important in web design. However, you cannot adjust the font size to make a paragraph look like a heading, or a heading to look like a paragraph.

Be sure to use the correct HTML tags,

-

for headings and

for paragraphs:

Font size values can be absolute or relative size.

Absolute size:

Set text of a specified size

Does not allow users to change text size in all browsers

Determines the physical size of the output Absolute size is useful

Relative size:

Set the size relative to surrounding elements

Allow the user to change the text size in the browser

If You don't specify a font size, and the default size is the same as a normal text paragraph, which is 16 pixels (16px=1em).

Set font size in pixels

Set text size in pixels, giving you full control over text size:

Use em To set the font size

To avoid the problem of being unable to resize text in Internet Explorer, many developers use em units instead of pixels.

em size units are recommended by W3C.

1em is equal to the current font size. The default text size in browsers is 16px.

Therefore, the default size of 1em is 16px. You can convert pixels to em with the following formula: px/16=em

Use a combination of percentage and EM

in all browsers In the solution, the default font size of the element is set as a percentage.

     

《七步诗》曹植

煮豆持做羹,

漉豉以为汁,

萁在釜下燃,

豆在釜中泣,

本自同根生,

相煎何太急?


Continuing Learning
||

《七步诗》曹植

煮豆持做羹,

漉豉以为汁,

萁在釜下燃,

豆在釜中泣,

本自同根生,

相煎何太急?

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!