About CSS

A stylesheet is a set of rules defining how an html element will be “presented” in the browser.

These rules are targeted to specific elements in the html document.

The “cascade” part of CSS is a set of rules for resolving conflicts with multiple CSS rules applied to the same elements.

For example, if there are two rules defining the color or your h1 elements, the rule that comes last in the cascade order will “trump” the other.

Inheritance

Most elements will inherit many style properties from their parent elements by default.

Specificity

Shortly after styling your first html elements, you will find yourself wanting more control over where your styles are applied.
This is where specificity comes in.
Specificity refers to how specific your selector is in naming an element.

HTML

<div id=”plan-2323”>
<p>Here is some text.</p>
<p>Hide this text.</p>
<div>
<div id=”plan-2323”>
<p>Here is some text.</p>
<p class=”hideclass”>Hide this text.</p>
<div>

CSS

#plan-2323.hideclass {display: none}
Share:

1 thought on “About CSS

Leave a Reply

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