Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Zecare Thomas
430 PointsGrowth on hover?
Hello, I am making a navigation bar and I have added some styles on hover, however when I hover over them my nav bar expands a bit, is there anyone to stop this effect?
Zecare Thomas
430 Points.tabs > li:hover { border: solid 1px #eeeded; background-color: #eeeded; border-radius: 2px; }
that's the code I have, and when I hover on the individual tab such as home or about my entire nav bar grows a bit.
2 Answers
Michalis Efstathiou
Courses Plus Student 4,638 Pointswell, on hover you have a border, do you have a border when its not on hover? if not that might be it
i think you can fix this by using box-sizing
Zecare Thomas
430 PointsThank you, the border was causing the issue, I removed it on hover, all is well now, thanx.
Michalis Efstathiou
Courses Plus Student 4,638 Pointszecare, if you want to keep your border, you can look into css box sizing, it will keep your elements width steady even after the addition of the border
Zecare Thomas
430 PointsThank you, I will try that as well.
Jeff Lemay
14,268 PointsFirst thing I add to a stylesheet:
* {
box-sizing: border-box;
}
Jeff Lemay
14,268 PointsJeff Lemay
14,268 PointsThere's most definitely a way to fix this but without seeing your site or code snippets it'll be tough for us to troubleshoot.