Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Pseudo classes

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 240
    Comment on it

    Pseudo class in css is used to define a special state of the element.

    It is used to style an element when a mouse may hover over it.

    It can be used to style a visited and unvisited link.

    It can be used to style an element on the focus.

    Syntax

    selector:pseudo-class {
        property:value;
    }

    ex

    /* unvisited link */
    a:link {
        color: #FF0000;
    }
    
    /* visited link */
    a:visited {
        color: #00FF00;
    }

    They can be combined with the css classes to give better style.

    a.highlight:hover {
        color: #ff0000;
    }

    You can also apply on the first-child pseudo-class matches a specified element that can be the first child of another element.

    p:first-child {
        color: blue;
    }

    For the first element you can take this ex

    p i:first-child {
        color: blue;
    }

    Match all element of the first child

    p:first-child i {
        color: blue;
    }

     

    The lang pseudo class:

    The :lang pseudo-class is used to define special rules for different languages.

    <html>
    <head>
    <style>
    q:lang(no) {
        quotes: "~" "~";
    }
    </style>
    </head>
    
    <body>
    <p>Some text <q lang="no">A quote in a paragraph</q> Some text.</p>
    </body>
    </html>

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: