Web page Standardized CSS code abbreviations streamlined instances

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Some CSS properties allow a string of values to be substituted for many properties, with the value separated by a space.

Margin,pdding and Border-width allow merging of Margin-top-width, Margin-right-width, Margin-bottom-width, and so on, in the form of: Property:top Right NRC left;

So the following code:

p {

border-top-width:1px;

border-right-width:5px;

border-bottom-width:10px;

border-left-width:20px;

Can be written as:

p {

border-width:1px 5px 10px 20px;

Border-width,border-color,border-style can also be merged together, for example:

p {

BORDER:1PX red Solid;}

(The same can be applied to border-top,border-right, etc.)

If you use only two values (such as margin:1em 10em;), the first value includes the top and bottom, and the second value is left or right.

Font properties can also be merged using the Font property.

p {

Font:italic Bold 1em/1.5 Courier;

(Above "/1.5" is the value of Line-height)

To sum them up, try the following code:

p {

font:1em/1.5 "Times New Roman", the Times, serif;

Padding:3em 1em;

BORDER:1PX Black Solid;

border-width:1px 5px 5px 1px;

Border-color:red Green blue yellow;

Margin:1em 5em;}

Recommend the use of abbreviations, to promote the simplification of CSS code, optimization!

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.