CSS Learning 14th bomb-code format shorthand induction

Source: Internet
Author: User

First, the Code short Way Induction "1. Box Model Code shorthand: margin (margin), padding (padding) and border (border) settings The margins in the left and right four directions are set in a clockwise direction: top left 1, The left value is the same as the following code: margin:10px 10px 10px 10px, abbreviated as: Margin:10px;2, if the top and bottom values are the same, left and right values are the same, as in the following code: margin:10px 20px 10px 20px; can be abbreviated as: margin:10px 20px;3, if left and right values are the same, such as code: margin:10px 20px 30px 20px; abbreviated to: margin:10px 20px 30px;***** Note: The existence of the left is omitted here. "2, the color of the abbreviation: the color of the CSS style can also be abbreviated, when you set the color is 16 binary color value, if each two bits of the same value, you can abbreviate half. Example 1:p{color: #000000;} can be abbreviated as: P{color: #000;} Example 2:p{color: #336699;} can be abbreviated as: P{color: #369;} "3, font expression abbreviation: The font CSS style code in the Web page also has his own abbreviation, the following is the code to set the font of the page:body{  font-style:italic;  font-variant:small-caps;    font-weight:bold;   font-size:12px;  line-height:1.5em;   font-family: "The song Body", Sans-serif;} So many lines of code can actually be abbreviated as a sentence:body{  font:italic small-caps bold 12px/1.5em "song Body", Sans-serif;} Note: 1, use this shorthand method you must specify at least the Font-size and Font-family properties, other properties (such as Font-weight, Font-style, Font-variant, Line-height) will automatically use the default value if not specified. 2, in the abbreviation font-size and line-height the middle to join "/" oblique carry. In general, because of the Chinese website, English is stillLess, so the following abbreviation code comparison commonly used:body{  font:12px/1.5em "song Body", Sans-serif;} Only font size, line spacing, Chinese fonts, English fonts are set. Note: You can omit some of the content in a specific order abbreviation, but the overall order is unchanged.    

CSS Learning 14th bomb-code format shorthand induction

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.