Here is the sample code: https://codepen.io/bmcdesign/pen/GRZrJxg
When you hover on a text item, the background does not fill the container.
Here is how I’m adjusting the background right now:
Is there a better way to do this? It seems there should be a more automatic way of doing it, without adjusting it pixel by pixel. I’m using Flexbox, so maybe there is a feature I could use?
It is the browser’s default margin/padding that add height to the list.
Try the standard list reset on the ul:
I tried adding that, but the background on hover still doesn’t fit the maximum height. I tried getting rid of the padding and margins in li:hover as well.
Hint: Is it overflowing the container with 5px?
Oops! Haha, I solved it now. Thanks.
I added this to the top as well:
How did that fix the padding difference of the navigation container (25px) and the hover padding/margin (30px) for the list-items?
N.B. The common general reset should only be used for testing! It is not recommended in any other case because that messes with all element. Instead reset the elements that needs it in current code.
Next time I’ll put my whole project on Codepen, because this is where the confusion came from. I tried giving a sample in the link above that highlighted the problem. The reason I got mixed up is because I tested it on my project thinking it would be the same as the Codepen link.
I did the general reset for other parts of the site. That is a good point that it’s only for testing. I didn’t know that and I won’t do it that way anymore.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.