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Łukasz Czuliński
8,646 PointsApplying box-sizing (or something similar) to list items.
I have an issue with my navigation bar. I have applied a border: 2px solid rgb(72,72,72)
to its li
items. However, when I hover, it seems to push them around ever so slightly despite applying border-box
to it.
Do list items not support box-sizing
? If not, any suggestions for a work-around?
1 Answer
Samuel Rueby
22,538 Pointsborder-box
just defines what width
and height
means. It doesn't change the fact that an element with a border is wider than the same element without a border. If you'd like your border only to appear on hover, I'd suggest adding a border to them without hover, and use a transparent color.
Łukasz Czuliński
8,646 PointsŁukasz Czuliński
8,646 PointsThanks! Perfect and simple solution that worked just as desired.