Search code examples
javascriptjqueryhtmlcssblock

Link Tag Display Block Not Stretching Full Width


Please correct me if I am wrong, but display: block; turns any element that has that CSS declaration into a block element, correct? That means that the specified element with the display: block; declaration will span it's entire width available, right?

I ask this because I currently have a navigation that houses a drop down menu with nested unordered list items, that are supposed to inherit the width of the width of the parent list item.

link removed

Notice once hovered over Teams, you see the 18U and 17U link list items are not stretching their appropriate width. I can only assume that this same issue is applying to all of the list link items.

BUT: Once you go here: link removed and notice there are more than two links, the issue is no longer a problem. It takes up the full width.

Also, once the page has loaded and you hover over one of the list items for the first time, the navigation menu is kicked to the right a little bit.

The problem is persistent in Google Chrome.

May someone help me out here? Thank you.


Solution

  • You have your li's width being set with

    width: 100%
    

    Which will only work if the elements parent (the ul) has a width set. Set...

    width: 100%
    

    ... on the ul too, and it works fine.