Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why overflow-y:hidden of HTML-lists makes bullet/number to be invisible?

I set <li>'s CSS property overflow-y to hidden, then its bullet/number was removed. Why? What is their relation? (How can I correct it?)

Here is a simple sample (With regard to @Paulie_D answer, I added overflow-x:visible):

li:first-child {
  overflow-y:hidden; 
  overflow-x:visible;
}
<ul>
    <li>Unordered list - Item 1</li>
    <li>Unordered list - Item 2</li>
</ul>
<ol>
    <li>Ordered list - Item 1</li>
    <li>Ordered list - Item 2</li>
</ol>

I ran it on Firefox v49.x and Chrome v54.x.


EDIT: Due to some answers, I explain:

enter image description here

Bullets/Numbers are outside of x-bounds, no y-bounds!

like image 598
Mir-Ismaili Avatar asked Oct 14 '25 13:10

Mir-Ismaili


1 Answers

The bullets are outside of list elements by default so overflow-y:hidden; hides them. You can use list-style-position: inside; to override the default outside value.

I know that; but they are outside of x-boundaries, no y-boundaries!

Check this image:

enter image description here

The blue box is the bounding box of the list element. The space before the list elements is the default padding of the parent ul and ol elements. So the bullets are outside of the list elements.

like image 61
undefined Avatar answered Oct 17 '25 22:10

undefined