Why is overflow: hidden; used here?? If i delete tag navigation bar disappeared? https://www.w3schools.com/css/tryit.asp?filename=trycss_navbar_horizontal_black
@SempervivumFeb 05.2019 — #Seems to be a mystery of float layout. I recommend using flexlayout instead as it's more clear and state of the art: ul { list-style-type: none; margin: 0; padding: 0; display: flex; /*overflow: hidden;*/ background-color: #333; }
@NogDogFeb 05.2019 — #Yeah, I remember using that hack before -- though I think I used overflow: auto -- so that the element containing the floating elements expanded to fit them, instead of essentially ignoring them.
@SempervivumFeb 05.2019 — #Now I understand: When floating, the parent element doesn't adjust to the size of the content and this trick works around that. Thanks for this hint.
@shadewFeb 06.2019 — #I tried deleting the overflow: hidden; and added a border around the list items. You can see this at the following link: https://www.w3schools.com/code/tryit.asp?filename=FZWG6IF2JOGV
You can see the borders and hover over to see that the list items are still there and the hover function still works. For some reason the overflow: hidden; or overflow: auto commands are the only way to to get the unordered list background-color to show up.
You can add this background-color to the li a {background-color: #333;} and the buttons are visible again without a border. Unless this overflow: hidden; can be explained I would guess that wrapping the entire list in a div and giving that div dimensions/background-color would be the correct way of display the menu bar.
@NogDogFeb 06.2019 — #The reason the overflow is needed is that that element is containing elements that are set to display: float, and for whatever reason the containing element no longer considers those floated elements when calculating its size. By adding the overflow setting, it now accounts for them. I have no idea what the rationale is for the rendering to work that way, just that it works. ?
@SempervivumFeb 06.2019 — #@shadew#1600744 Please don't ignore my recommendation for using flex layout. It will guard against further trouble by use of float layout which is outdated while flex is state of the art.
@LearnTheNewFeb 06.2019 — #he overflow property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area.
The overflow property has the following values:
visible - Default. The overflow is not clipped. The content renders outside the element's box
hidden - The overflow is clipped, and the rest of the content will be invisible
scroll - The overflow is clipped, and a scrollbar is added to see the rest of the content
auto - Similar to scroll, but it adds scrollbars only when necessary
overflow: hidden
With the hidden value, the overflow is clipped, and the rest of the content is hidden
@shadewFeb 06.2019 — #@Sempervivum#1600758 You are correct, thank you for addressing this. I got caught up in finding the "correct" way to fix this issue with float layout, when using flex (or grids) would certainly be the modern method.