Clone Project

Avoid layout shifting when using Bold on Hover

Created by
Felix Gonzalo
Similar Projects
Oops! Something went wrong while submitting the form.

0 Comments

Be the first to leave a comment.
Loading
User is typing...
No Name
Set
4 years ago
Moderator
This is the actual comment. It's can be long or short. And must contain only text information.
(Edited)
No Name
Set
2 years ago
Moderator
This is the actual comment. It's can be long or short. And must contain only text information.
(Edited)
Load More
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Load More
Description:  
Description from Webflow:  
If you’ve tried making text bold on hover, you’ve likely noticed this annoying side effect: The layout shifts. The browser recalculates the width of the bolded text, causing a "jump." Avoid layout shifting when using Bold on Hover (Here’s how 👇): 1. Clone the text content with the `content: attr(data-content)` property. 2. Style the ::before to match the bold hover state. 3. Hide it but keeping its width in the layout. This trick is especially helpful for Nav links, tab links, or buttons where you want a smooth hover effect without layout shifts.
Tags from Webflow: 
css,  css animation,  csstrick
.