Now many people use the CSS code is very redundant, in fact, many can simplify the abbreviation.
This time, let's talk about the simplified abbreviation for CSS code as you know it.
1, all CSS code as long as the use of a style tag can be, there is no need to add one each paragraph, is simply superfluous. For example:
Body{background:url ("") Repeat fixed!important;}
. Bodybg{background:url ("") no repeat no scroll!important;}
You can simplify merging to:
Body{background:url ("") Repeat fixed!important;}
. Bodybg{background:url ("") no repeat no scroll!important;}
Like changing the background of each part of the blog, change the font color of each part of the blog, change the template width, mouse, scroll bar and other CSS code can be merged into a style tag.
2, Color: 16 color value, if each two bits of the same value, you can abbreviate half, for example:
Black #000000 can be abbreviated as #000;
White #ffffff can be abbreviated as #fff;
Red #ff0000 can be abbreviated as #f00;
Blue #0000ff can be abbreviated as #00f;
#336699可以缩写为 #369.
Some common commonly used colors such as black, white, red, blue, green, yellow and so on if you can not remember their code, the corresponding English black,white,red,blue,green,yellow and so on to express.
3, the same identity for multi-attribute control when you can put a few attributes in a curly brace, the middle of different attributes separated by semicolons. For example, large backgrounds and scroll bars:
Body {Background:url ("") Repeat fixed!important;}
Body {scrollbar-face-color: #EDF6F5;
Scrollbar-highlight-color: #fff;
Scrollbar-shadow-color: #fff;
Scrollbar-3dlight-color: #000;
Scrollbar-arrow-color: #000;
Scrollbar-track-color: #EDF6F5;
Scrollbar-darkshadow-color: #000;}
can be abbreviated as a sentence: Font:italic small-caps bold 1em/140% "Lucida Grande", Sans-serif;
Note that if you abbreviate a font definition, you must define at least two values for font-size and font-family.
10, CSS code does not remember the case, line, blank, as long as the format on the line.
The advantage of CSS abbreviations for us blogging is that it simplifies the code so that it doesn't look so redundant, and the most important thing is to make a website,
The speed of the CSS stylesheet file call is related to the size of its file, so the smaller the file, the faster the call,
In one respect, you can improve the loading speed of web pages, and speed is a critical factor for a website.
So the CSS style sheet file should be abbreviated as much as possible to simplify the code, like some extra space,
And for example, I in the overall template six "lock heart for You" provided in the code to add comments, etc. should be removed as far as possible.
The following is a list of the properties of the CSS abbreviation and the general nature of what they represent:
Background (background): Background attachment, background color, background image, background position, background repetition
Border (border): border color, border style, border width
Border-bottom (bottom border): Bottom border color, bottom border style, bottom border width
Border-left (left border): Left border color, left border style, left border width
Border-right (right border): Right border color, right border style, right border width
Border-top (top border): Top border color, top border style, top border width
Cue (sound hint): Front prompt, after prompt
Font (font): typeface, font size, font style, font weight, font variation, line height, font sizing, font stretch
List-style (List style): List style image, List style position, List style type
Margin (blank): Top blank, right blank, bottom blank, left blank
Outline (outline): outline color, outline style, outline width
Padding (GAP): top clearance, right clearance, bottom clearance, left gap
Pause (pause): Pause after, pause before
Attachment is a very useful CSS code Editor, you can display the effect in time.
()
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.