Weight and origin
From here on out will face another set of basic concepts, however, all traceable to the same area: the possible conflicts between the styles and rules. We will try in practice to answer questions like this. If I define these rules in a CSS:
Code:
p {color: black;}
.Text {color: red;}
And in an HTML page, write this code:
HTML Code:
<p class="text"> paragraph </ p>
Because the text of the paragraph will be red and not black? Because the class selector overrides the simple element. The first concept to learn is by weight. Refers to a greater or lesser importance to be assigned to each rule. A first important criterion is given by 'origin of the style sheet. When you view a page (X) HTML can play a part in changing the style of three different elements of style sheets:
- sheet author
- User Sheet
- worksheet's default browser
In order of importance, we have: the author's paper, spreadsheet user, the browser default sheet. All the latest navigation software can manage this aspect. E 'can, for example, make the browser ignore the CSS defined by the author of the pages and format them with CSS made by the user. And yet, as we shall see, you can change this hierarchy by using the keyword! Important - Basically, however, the order shall be as defined above.
Bookmarks