CSS style sheets should also be structured

a lot of people might wonder what the title means, but what’s the structure of a style sheet? And listen to the following reasons:

play Web friends on CSS reconstruction should not be unfamiliar, CSS all know that there are several commonly used selector method style definitions, several commonly used wit will generally explain: the first one is

* {margin:0px; padding:0px

After this setting of

, all the elements have set the margins and the outer distance to 0px.

second is the type selector, and the wit likes to call it a tag selector, which is directly defined by the name of the tag element, such as:

body {font-size:14px

After this setting of

, the font size in all body elements is 14px, but the table element is an exception, so the table element font size is the same, so:

body, TD {font-size:14px

third is the ID selector, which defines the style of an element through a unique ID identifier, such as:

#nav {color:red


sets this, the font under the NAV element should be red.

fourth is the class selector, and the wit is generally called the class selector, which defines a style through a class that allows all elements that specify that class to take effect, such as:

.left {text-align:left

defines two classes, so after setting, specify the elements under which the elements of the class are left or right, depending on the style definition in the class.

generally use about these four, and what are the attribute selectors, including selectors, i.

Leave a Reply

Your email address will not be published. Required fields are marked *