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

CSS

Growth 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?

There's most definitely a way to fix this but without seeing your site or code snippets it'll be tough for us to troubleshoot.

.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

well, 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

Thank you, the border was causing the issue, I removed it on hover, all is well now, thanx.

zecare, 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

Thank you, I will try that as well.

First thing I add to a stylesheet:

* {
  box-sizing: border-box;
}