Simplify the common CSS Property code to make your CSS more concise and clear

Source: Internet
Author: User

Simplify CSS Property code, you can make the size of the CSS file smaller, faster reading speed, maintainability is higher.

The following are examples of the most common ways to simplify CSS Property code:

Margin
margin-top:1px;
margin-right:1px;
margin-bottom:1px;
margin-left:1px;
Code simplification to: margin:1px

margin-top:1px;
margin-right:2px;
margin-bottom:1px;
margin-left:2px;
Code simplified to: margin:1px 2px

margin-top:1px;
margin-right:2px;
margin-bottom:3px;
margin-left:2px;
Code simplified to: margin:1px 2px 3px

margin-top:1px;
margin-right:2px;
margin-bottom:3px;
margin-left:4px;
Code simplified to: margin:1px 2px 3px 4px
When the property value is 0, the unit can not write such as: 0px directly written as 0

Padding
Padding's writing method is the same as that of margin, where there is no more narration.

Border
border-width:1px;
Border-style:solid;
Border-color: #000000;
Code simplification is: border:1px solid #000

Background
Background-color: #CCFFFF;
Background-image:url (picture path);
Background-repeat:repeat-x;
background-position:5px 4px;
Code simplified to: background: #CFF URL (picture path) repeat-x 5px 4px

Font
font-size:26px;
Font-weight:bold;
Font-family: "The song Body";
Code simplification: font:26px bold "XXFarEastFont-Arial"

Color Property value
Color: #000000;
Color: #ff0000;
Code simplification to: color: #000, color: #f00



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.