CSS optimized compression

Source: Internet
Author: User

As the name implies shorthand, then summarize the CSS abbreviation knowledge points.
Why do I have to abbreviate CSS properties?
1, simplify the code. Some CSS property shorthand reduces CSS code and thus reduces the amount of bytes used in CSS files. Speed up page downloads and page loading.
2, optimize the CSS purpose. One of the CSS optimizations is to simplify the code abbreviation for the CSS Property code.
CSS style attribute word code shorthand optimization
(1) CSS text:

(2) CSS background:

Background-color: #F00; Background-image:url (image address); background-position:bottom;background-repeat:no-repeat; You can abbreviate the background CSS property to: Background: #F00 URL (image address) No-repeat bottom;

(3) CSS padding (CSS padding):

PADDING-TOP:5PX;PADDDING-RIGHT:20PX;PADDING-BOTTOM:10PX;PADDING-LEFT:15PX can be abbreviated as: padding:5px 20px 10px 15px; or padding-top:5px;padding-bottom:5px;padding-left:10px;padding-right:10px; abbreviated as: padding:5px 10px;

(4) CSS margins (CSS margin):

margin-top:5px;         margin-right:20px;margin-bottom:10px;margin-left:15px; margin:5px 20px 10px 15px; or: margin-top:5px; margin-bottom:5px;margin-left:10px;margin-right:10px; abbreviated as: margin:5px 10px;

(5), CSS border:

border-top:1px solid #000, border-right:1px solid #000, border-bottom:1px solid #000; border-left:1px solid #000; can be abbreviated as: border:1px solid #000;

Second, the punctuation optimization:
Summary: Summarize the commonly used CSS abbreviation, hope in the future production practice more use and a lot of summary.

CSS optimized compression

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.