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

Navbar changing height when adding a border on hover

I'm working on a project using Bootstrap and want the links in my navbar to have a top border when hovering over them, however, when I do hover over them, it increases the navbar height as seen in the codepen http://codepen.io/tiffmc/pen/LVMxqG

Isn't this what box-sizing: border-box is for?

1 Answer

I believe border-box has an issue calculating the size differences when a size value hasn't been specified.

Try adding a height property to your nav li -

.nav li {
    box-sizing: border-box;
    height: 50px;
    border-left: 1px solid #555;
}

If you don't want your content inside each li to be pushed down by the border, I might suggest adding an existing border of the same color, so that the position stays the same.