Pseudo classes are used to style elements in certain states like when moused over or focused. Common pseudo classes include :hover, :active, :visited, and :first-child which select links on hover, active links, visited links, and first child elements. Pseudo classes define a special state using a colon unlike classes which are defined with a dot.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views
Pseudo Classes
Pseudo classes are used to style elements in certain states like when moused over or focused. Common pseudo classes include :hover, :active, :visited, and :first-child which select links on hover, active links, visited links, and first child elements. Pseudo classes define a special state using a colon unlike classes which are defined with a dot.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7
Pseudo Classes
A pseudo class is used to define a special state of an element.
For example, it can be used to: • Style an element when a user mouses over it • Style visited and unvisited links differently • Style an element when it gets focus Types of Pseudo Classes Selector Example Description :active a:active Selects the active link :checked input:checked Selects every checked <input> element :empty p:empty Selects every <p> element that has no children
:first-child p:first-child Selects every <p> elements that is the first child of its parent
:hover a:hover Selects links on mouse over
:visited a:visited Selects all visited links
:empty p:empty Selects every <p> element that has no
children Types of Pseudo Classes For Example Difference between Class and Pseudo Class
Class Pseudo Class
A class is used to define property of A pseudo class is used to define a an HTML element when a webpage special state of an element which is opened and it is viewed at the first will happen once you do some place. activity on the webpage. Class is defined using a dot(.). A pseudo class is defined using a colon(:). Example Thank You