Site Discription

Welcome to JalalZoon Website

This is Educational website.You can search for Programming languages mostly HTML, CSS, PHP and Java.This website also contains data about Study Techniques and tips for study effectively. Math tutorials are included very Soon.

Search your content here!!!

Wednesday, May 2, 2018

precedence of css rules

How CSS Rules Cascade

If there are two or more rules that apply to the same element,
it is important to understand which will take precedence.

LAST RULE

If the two selectors are identical, the latter of the two will take
precedence. Here you can see the second i selector takes precedence
 over the first.

SPEC IFICITY

If one selector is more specific than the others, the more
specific rule will take precedence over more general ones.

Example.html

<h1>Potatoes</h1>
<p id="intro">There are <i>dozens</i> of different
<b>potato</b> varieties.</p>
<p>They are usually described as early, second early
and maincrop potatoes.</p>


CSS file
* {
font-family: Arial, Verdana, sans-serif;}
h1 {
font-family: "Courier New", monospace;}
i {
color: green;}
i {
color: red;}
b {
color: pink;}
p b {
color: blue !important;}
p b {
color: violet;}
p#intro {
font-size: 100%;}
p {
font-size: 75%;}

 In this example: h1 is more specific than * p b is more specific than p p#intro is more specific than p

IMPORTANT


You can add !important after any property value to indicate
that it should be considered more important than other rules that apply to the same element.
Understanding how CSS rules cascade means you can write simpler style sheets because you can create generic rules that apply to most elements and then override the properties on individual elements that need to appear differently.


Type your Comments

Comment Box is loading comments...

Like website using facebook

12th Class Math || Ch 1 Function and Limits || Exercise 1.3 Question no 2

12th Class Math || Ch 1 Function and Limits || Exercise 1.3 Question no 2 12th Class Math || Ch 1 Function and Limits || F.S.C. & I.C.S ...

Contact Us for more help

Name

Email *

Message *