Hi I'm having issues with list-style-position: inside
when using IE. On Firefox or Chrome it does not seem to have this problem.
ol.myList { list-style-position:inside; }
ol.myList li { padding:20px 10px; font-weight:bold }
ol.myList li p { font-weight:normal }
<ol class="myList" start="1">
<li>
<h4>My Title</h4>
<p>My Details</p>
</li>
</ol>
On Chrome/Firefox it shows like this:
1. My Title
My Details
But on IE it shows this:
1.
My Title
My Details
Any suggestion in order to get it to work on IE?
list-style-position: inside; means that the bullet points will be inside the list item. As it is part of the list item, it will be part of the text and push the text at the start: Coffee - A brewed drink prepared from roasted coffee beans...
list-style-type: It is used to specify the type of list-item marker in a list. list-style-position: It is used to specify the position of the list-item markers.
The list-style-position property specifies the position of the list-item markers (bullet points). list-style-position: outside; means that the bullet points will be outside the list item. The start of each line of a list item will be aligned vertically: Coffee - A brewed drink prepared from roasted coffee beans...
The list-style-position property defines where to position the list marker, and it accepts one of two values: inside or outside.
This is an inconsistency among browsers. Firefox displays the number/bullet on a separate line, as does IE.
Use display: inline-block
on the h4
and *display: inline; zoom: 1;
for IE7.
ol.myList li h4 {
display: inline-block;
*display: inline;
zoom: 1;
}
Quote from the Mozilla documentation regarding this issue: https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-position#Browser_compatibility
N.B. There is variance among browsers regarding behaviour when a block element is placed first within a list element declared as list-style-position:inside. Chrome and Safari both place this element on the same line as the marker box, whereas Firefox, Internet Explorer and Opera place it on the next line. For more information on this, see this Mozilla Bug report and an example.
Ah Pek, try this:
ol.myList li h4 { display: inline-block; }
or
ol.myList li h4 { display: inline; }
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