I have a simple ordered list, super easy:
http://www.bootply.com/P8wglPiSVD
Looks like this:
<div class="container">
<div class="row">
<div class="col-xs-12">
<ol class="list-group">
<li class="list-group-item">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae, aliquid.</p>
</li>
<li class="list-group-item">
<p>Quos nostrum provident ex quisquam aliquid, hic odio repellendus atque.</p>
</li>
<li class="list-group-item">
<p>Facilis, id dolorum distinctio, harum accusantium atque explicabo quidem consectetur.</p>
</li>
</ol>
</div>
</div>
</div>
But twitter bootstrap isn't showing any numbers, even though it is an ordered list.
I searched but didn't find any twitter bootstrap compontent that styles ordered list items and this makes me curious. Is there a lacking in a predefined style for Twitter Bootstrap for ordered lists or am I missing something?
Kind regards,
George
Placing Ordered and Unordered List Items Inline. If you want to create a horizontal menu using the ordered or unordered list you need to place all list items in a single line (i.e. side by side). You can do this simply by adding the class . list-inline to the <ul> or <ol> , and the class .
List Group With Linked Items: Use <div> and <a> tag instead of <ul> and <li> to create a list of group with linked items. The . list-group-item-action class is used to set the hover effect to change the background color to gray.
To create ordered list in HTML, use the <ol> tag. Ordered list starts with the <ol> tag. The list item starts with the <li> tag and will be marked as numbers, lowercase letters uppercase letters, roman letters, etc. The default numbers for list items.
The most basic list group is an unordered list with list items: First item. Second item. Third item.
Combining @Steve Sanders and @beiping_troop answers, you can create clean ordered list-groups with the following CSS:
.list-group {
list-style: decimal inside;
}
.list-group-item {
display: list-item;
}
http://www.bootply.com/BJadu6Ja6R
Bootstrap is applying display: block
to the list items, which kills the numbering. Add this to your CSS:
.list-group-item {
display: list-item;
}
http://www.bootply.com/ZHQBWK9sHB
For just a clean ordered list, I chose an inline style override since I was only calling out a numbered list in one place. It rendered just fine:
<ol style="list-style: decimal inside;">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
My reference was originally here: Bootstrap: numbers from ordered list disapear when using media object
I found a better solution is to add a new css class to the list group depending on the style of numbering you want for example "list-group-numbered" or "list-group-alpha" that way you can add the numbering to only the ordered lists you want to add it to and not to all numbered lists, especially if you have somewhere else on the website that has numbered lists that now looks wrong...
.list-group-numbered { list-style: decimal inside; }
.list-group-alpha { list-style: lower-alpha inside; }
.list-group-roman { list-style: lower-roman inside; }
.list-group-alpha >li, .list-group-numbered >li { display: list-item }
then you can put in the following in html..
<ol class="list-group list-group-numbered">
<li class="list-group-item">an item
<ol class="list-group list-group-alpha">
<li class="list-group-item">a sub item
<ol class="list-group list-group-roman">
<li class="list-group-item">a sub-sub item</li>
</ol>
</li>
</ol>
</li>
<li class="list-group-item">another item</li>
<li class="list-group-item">a third item</li>
</ol>
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