I'm trying to create an ingredients list, where I'm using the ul
and li
elements with div
s inside of each li
element for each different information type (amount, description or price). In the third li
element, the description is too long to fit in the normal space of its own div. This causes it to overflow downwards (not to the right). This is fine, but the probem is that the next li
element starts in the wrong place because of this overflow. I've marked the text that is rendered in the wrong place.
ul {
list-style: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
<ul>
<li>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
1
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
thawed puff pastry sheet
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
2 USD
</div>
</li>
<li>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
~
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
All-purpose flour, for rolling
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
5 USD
</div>
</li>
<li>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
1
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
round brie cheese (8 to 12 ounces, 5- to 7-inch diameter)
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
10 USD
</div>
</li>
<li>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
1
<!--- WRONG PLACE. Should start on new row -->
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
Large egg, beaten
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
1 USD
</div>
</li>
<li>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
~
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
Baguette slices or crackes, to serve
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
1 USD
</div>
</li>
</ul>
</div>
What can I do to make each li
element start on a new row, even if the element above overflowed?