Update format
This commit is contained in:
@ -5,6 +5,10 @@ tags: visual,beginner
|
||||
|
||||
Fancy hover and focus effect at navigation items using transform CSS property.
|
||||
|
||||
- Use the `:before` pseudo-element at the list item anchor to create a hover effect, hide it using `transform: scale(0)`.
|
||||
- Use the `:hover` and `:focus` pseudo-selectors to transition to `transform: scale(1)` and show the pseudo-element with its colored background.
|
||||
- Prevent the pseudo-element from covering the anchor element by using `z-index: -1`.
|
||||
|
||||
```html
|
||||
<nav class="hover-nav">
|
||||
<ul>
|
||||
@ -54,9 +58,3 @@ li a:focus:before {
|
||||
transform: scale(1);
|
||||
}
|
||||
```
|
||||
|
||||
#### Explanation
|
||||
|
||||
- Use the `:before` pseudo-element at the list item anchor to create a hover effect, hide it using `transform: scale(0)`.
|
||||
- Use the `:hover` and `:focus` pseudo-selectors to transition to `transform: scale(1)` and show the pseudo-element with its colored background.
|
||||
- Prevent the pseudo-element from covering the anchor element by using `z-index: -1`.
|
||||
|
||||
Reference in New Issue
Block a user