What are pseudo classes?

  • : 349
  • : 15
    Previous Next

    Pseudo classes allow you to identify HTML elements on characteristics (as opposed to their name or attributes). The classes are specified using a colon to separate the element name and pseudo class. A good example is the :link and :visited pseudo classes for the HTML A element. Another good example is first-child, which finds an element's first child element.

    The following CSS makes all visited links red and green, the actual link text becomes yellow when the mouse pointer is positioned over it, and the text of the first element of a paragraph is bold.

    a:link {font-color: red;}
    a:visited {font-color: green;}

    a:hover {font-color: yellow;}
    p.first-child {font-weight: bold;}

    you can suggest other answer in comment box

  • Exam: CSS Interview QUESTIONS

    Recommended Learning for you

    Subscribe here for free mock test on IAS PCS SSC and other competitive exam. Signup here to get SSC CGL Solution and main exam study material