CSS Super Tips (2)

Source: Internet
Author: User
Tags definition
css| tips Five. Default value

Usually the default value for the padding is transparent, which is the default value for 0,background-color. However, the default values for different browsers may be different. If you are afraid of conflict, you can define the margin and padding values for all elements at the beginning of the stylesheet as 0, like this:

* {
margin:0;
padding:0;
}

Six. You do not need to repeat the definition of inheritable values

In CSS, child elements automatically inherit the attribute values of the parent element, such as color, font, and so on, that are already defined in the parent element and can be directly inherited in child elements, without having to repeat the definition. Note, however, that the browser may overwrite your definition with some default values.

Seven. Recent priority principles

If there are multiple definitions of the same element, the closest (least level) definition is the highest priority, such as a piece of code

Update:lorem ipsum dolor Set

In the CSS file, you have defined the element p and defined a classupdate

p {
Margin:1em 0;
Font-size:1em;
Color: #333;
}
. Update {
Font-weight:bold;
Color: #600;
}



Related Article

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.