Day 16: CSS: Pseudo-classes
1. Pseudo-classes :
- A selector's keyword that specifies a specific state of the chosen element is called a CSS pseudo-class.
- :hover : When our mouse pointer is over a particular element, this pseudo-class can be used to give it a distinctive effect.
- Example :
- Code :
Output:
Before hovering : (The div background color is red)
While hovering : (The div background color is changed from red to green)
- :active : The active link is chosen and styled using the :active selector.
- Clicking on a link makes it active.
- All elements, not only links, can be utilized with the :active selector.
- Example: While you click on the link, the code in the example below will increase the font size of the link to 30px.
Code :
Comments
Post a Comment