You can do this:
.info
{
padding: 5px ;
}
Or, if you know it will be a div
, you can do this
div.info
{
padding: 5px ;
}
So, when there's a nested list.. you can do this..
div.info ul.navbar li.navitem a.sitelink
{
color: #f00;
}
Or you can do this
a.sitelink
{
color: #f00;
}
Readability aside, which is better for the browser to parse/run?
Inline styles added to an element (e.g., style="font-weight: bold;" ) always overwrite any normal styles in author stylesheets, and therefore, can be thought of as having the highest specificity.
CSS Order Matters In CSS, the order in which we specify our rules matters. If a rule from the same style sheet, with the same level of specificity exists, the rule that is declared last in the CSS document will be the one that is applied.
Properties of CSS: Inline CSS has the highest priority, then comes Internal/Embedded followed by External CSS which has the least priority.
Specificity Rules include:CSS style applied by referencing external stylesheet has lowest precedence and is overridden by Internal and inline CSS. Internal CSS is overridden by inline CSS. Inline CSS has highest priority and overrides all other selectors.
Keep rules as general as possible -- it is faster and uses less bytes. See Google's article for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With