Summary of common CSS abbreviations

Source: Internet
Author: User

 

Using abbreviations can help reduce the size of your CSS file and make it easier to read. The main rules for CSS abbreviations are as follows:

Color

The hexadecimal color value. If the two values are the same, they can be abbreviated to half. For example:
#000000 can be abbreviated as #000; #336699 can be abbreviated as #369;

Box Size

There are usually four writing methods:

    • Property: value1; indicates that all edges are value1; property: value1 value2; indicates that the top and bottom values are value1, and the right and left values are value2property: value1 value2 value3; the value of top is value1, the value of right and left is value2, and the value of bottom is value3property: value1 value2 value3 value4. The four values represent top, right, and bottom in turn, the easy way to remember left is clockwise, top right bottom left. An example of the specific application in margin and padding is as follows: margin: 1em 0 2em 0.5em;

       

Border (Border)

The border attributes are as follows:

    • Border-width: 1px; border-style: solid; border-color: #000; can be abbreviated as: Border: 1px solid #000; Syntax: Border: width style color;

       

Background (backgrounds)

The attributes of the background are as follows:

    • Background-color: # f00; Background-image: url(background.gif); background-repeat: No-Repeat; Background-Attachment: fixed; Background-position: 0 0; can be abbreviated as one sentence: background: # f00 url(background.gif) No-repeat fixed 0 0; Syntax: Background: Color Image repeat attachment position; you can omit one or more attribute values, the default value of this attribute is browser. The default value is: Color: transparentimage: nonerepeat: repeatattachment: scrollposition: 0% 0%.

       

Fonts)

The font attributes are as follows:

    • Font-style: italic; font-variant: Small-caps; font-weight: bold; font-size: 1em; line-Height: 140%; font-family: "lucida Grande", sans-serif; can be abbreviated as: Font: italic small-caps bold 1em/140% "lucida Grande", sans-serif; note, if you are short for font definition, you must at least define the font-size and font-family values.

       

 

List (lists)

To cancel the default dot and serial number, you can write list-style: none ;,

The list attributes are as follows:

    • List-style-type: Square; List-style-position: Inside; List-style-image: url(image.gif); can be abbreviated as: List-style: square inside url(image.gif );

       

 

 

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.