css spcificity

technical talkiess
0

 Css specificity:- 

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Css specificity</title>

</head>

<style>

    /* inline css ko sabse jada importace dete hai -1000  */

    /* color:"red !important "dete hai to usko jada importance rahta hai  */

    /* uske badd id selecotor jada importance rahta hai -100

     */

     /* class -10 */

     /* isme same class hai to last wale me jata hai call */

     /* tag selector = 1 */

     /* h1.color = 1+10 = 11 */


     /* Specificity Calculation

To calculate specificity, assign a value to each part of the selector:


Universal Selector: 0

Element selectors and pseudo-elements: 1

Class selectors, attribute selectors, and pseudo-classes: 10

ID selectors: 100

Inline styles: 1000

Then, add up the values of all the parts in the selector.


Here is an example  */



</style>

<body>

    <div class="container">

        <p class="yellow green red">

            Lorem ipsum dolor sit amet consectetur adipisicing elit. Illum reprehenderit totam commodi ea alias dolorum eius at assumenda, consequatur asperiores.

        </p>

    </div>

</body>

</html>


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)