Common CSS abbreviation syntax summary

xiaoxiao2021-03-05  19

Common CSS abbreviation syntax summary

Author: Acha 2005-4-8 15:28:00

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

colour

16-based color value, if each two is the same, you can abbreviate half, for example: # 000000 can be abbreviated as # 000; # 336699 can be abbreviated as # 369;

Box size

There are usually the following four writing methods:

Property: Value1; Indicates all the edges are valued value1; property: value1 value2; the value of TOP and BOTTOM is Value1, Right and Left value is Value2 Property: value1 value2 value3; indicating that the value of TOP is Value1, Right and LEFT The value is Value2, and the value of Bottom is Value3 property: value1 value2 value3 value4; four values ​​are represented by Top, Right, Bottom, LEFT

The convenient memory method is clockwise, top left. The examples of specifically in Margin and Padding are as follows: Margin: 1EM 0 2EM 0.5EM;

Border (Border)

The properties of the border are as follows:

Border-width: 1px; border-style: solId; border-color: # 000;

Can be abbreviated as a sentence: border: 1px solid # 000;

The syntax is border: width style color;

Backgrounds

The properties 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;

You can abbreviate as a sentence: background: # f00 url (background.gif) No-repeat fixed 0 0;

The syntax is Background: Color Image Repeat Attachment POSITION;

You can omit one or more attribute values, if omitted, this property value will use the browser default value, the default value is:

Color: Transparent Image: None Repeat: Repeat Attachment: Scroll Position: 0% 0%

Font (Fonts)

The properties of the font 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 a sentence: font: Italic Small-Caps Bold 1EM / 140% "Lucida Grande", SANS-Serif;

Note that if you abbreviate the font definition, at least two values ​​to Font-size and Font-Family are defined.

List (lists)

Cancel the default dot and serial number to write List-style: none;

The properties of the list are as follows:

List-style-type: Square; list-style-position: inside; list-style-image: URL (Image.gif);

You can abbreviate: List-style: Square Inside URL (Image.gif);

转载请注明原文地址:https://www.9cbs.com/read-36768.html

New Post(0)