Front-end learning--CSS--Several attributes of font learning

Source: Internet
Author: User

Font-style can be used to set the text italic

-Optional values:

    1. Normal, default value, text is displayed correctly
    2. Italic text is displayed in italics
    3. Oblique text is displayed with a slanted effect

-Most browsers do not differentiate between italic and italic, meaning that we set italic and oblique their effects are often the same
-Generally we will only use italic

Font-weight can be used to set the text's bold effect

Optional values:

    1. Normal, default value, text is displayed correctly
    2. Bold, Text bold display

The style can also specify a value of 9 between 100-900,
But because the user's computer often does not have so many levels of font, so to achieve the effect we want
That is, 200 is probably thicker than 100, 300 is probably thicker than 200, but it could be the same.

Font-variant can be used to set small caps

Optional values:

    1. Normal, default value, text is displayed correctly
    2. Small-caps text is displayed in small caps

Small caps:
All letters are shown in uppercase, but lowercase letters are capitalized,
Smaller than the size of the uppercase letters.

In the CSS also provides us with a style called font, using this style can set all the font-related styles, you can use the font style of the value, unified in the font style, different values are separated by a space
When font style is set with font, the italic size is bold, there is no order, it can even be written without writing, if you do not write the default value is used, but the font must be written in the font, and the text must be the last style, the size must be the second

In fact, using the shorthand attribute also has a better performance

First example: Use font to set all styles related to the font.

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>        <styletype= "Text/css">P{Color:Red;Font:small-caps Bold Italic 20px "Microsoft Ya Hei";            }        </style>    </Head>    <Body>        <P>the sunrise, and the day into the interest. To dig well and drink, to plough and eat. Dili to me! ABC abc</P>    </Body></HTML>

Look at the effect:

A second example:

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>        <styletype= "Text/css">. P1{Color:Red;                /*set a text size*/font-size:55px;                /*Set a font*/font-family:"Agency FB";                /*Set Text italic*/Font-style:Italic;                /*Set the text bold*/Font-weight:Bold;                /*set a small capital letter*/font-variant:Small-caps;            }        </style>    </Head>    <Body>        <Pclass= "P1">The sunrise, and the day into the interest. To dig well and drink, to plough and eat. Dili to me! ABC abc</P>    </Body></HTML>

Look at the effect:

Front-end learning--CSS--Several attributes of font learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.