I am getting an unexpected (to me) behaviour where a vertical scroll bar is showing up. I do not understand what the constraint on the height of the container might be.
I am able to make this problem go away by either changing the LI's margin:1 or set the UL's lineheight: normal instead of 1.
Can anyone explain what is actually occurring? That is to say what height have I exceeded that requires a vertical scrollbar?
I created a very simple JSFIDDLE to illustrate the issue I am having.
HTML code:
<div class="content-section" >
<ul >
<li>cheese</li>
<li>crackers</li>
</ul>
</div>
CSS code:
body {
line-height: 1;
}
ul {
margin: 0;
}
.content-section {
overflow-y: auto;
}
tooltip has a css property of overflow-y:scroll; . This causes the scrollbar to always show. You should change it to overflow-y:auto; . This will cause it to show only when needed.
There, 100vw causes horizontal overflow, because the vertical scrollbar was already in play, taking up some of that space.
The overflow-y property specifies whether to clip the content, add a scroll bar, or display overflow content of a block-level element, when it overflows at the top and bottom edges.
This is because your line-height
is set to 1, which means the line-height is the same as the font-size. This causes the font to slightly overflow the line. You need to set line-height
to a value greater than the height of the text, as you may have guessed. The text is technically behaving as it should. The height of the box is defined by the height of the lines, but the text is ever so slightly larger than the lines. Your line-height should never be equal to your font-size from a readability standpoint. I hope this helps. I know it doesn't exactly tell you where the height is coming from, but I believe you have successfully explored multiple means of combating it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With