Optimizing Code: Web page technology abbreviations for the font properties of CSS

Source: Internet
Author: User
css| Skills | website | optimization

Optimization Code: web page Technology CSS font properties of the abbreviation of the skills, abbreviations to reduce the code, optimize the CSS to make it more reasonable.

The CSS Font property is used to control text font, color, size, and so on. There are a variety of font properties, and in general, we use abbreviations to generalize a number of attributes in a single CSS code. This greatly reduces the code and optimizes the CSS file.

The following six kinds of font properties are commonly used:

Font-style set oblique body such as: font-style:italic;
Font-weight set text thickness such as: font-weight:bold;
Font-size set text size such as: font-size:12px;
Line-height set line spacing such as: line-height:150%;
Color Set text colors (note is not font-color) such as: color:red;
Font-family set fonts such as: font-family: "Lucida Grande", Verdana, Lucida, Arial, Helvetica, XXFarEastFont-Franklin, Sans-serif;

We can summarize the above attributes in one line of the Font property. Note that the color attribute needs to be defined separately.

Font:italic bold 12px/150% "Lucida Grande", Verdana, Lucida, Arial, Helvetica, XXFarEastFont-Franklin, Sans-serif;

The above example uses a row to define the Font property, respectively: Font-style font-weight font-size line-height font-family, and color set text colors to be defined separately.



Related Article

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.