I’m trying to create a list, with each <li> on one row. My problem lies at ‘Food 4,’ where I need to have a note describing the <h4>; I can’t seem to clear the line break created by the <p>. I’ve tried <p style="display:inline> and every variation I could think of. What am I missing?
<div id="carte">
<h3 class="list-title">Menu a la carte</h3>
<ul>
<li><h4>Food 1 $20</h4></li>
<li><h4>Food 2 $30</h4></li>
<li><h4>Food 3 $40</h4></li>
<li><h4>Food 4 $50</h4><p>vegetarian</p></li>
<li><h4>Food 5 $60</h4></li>
</ul>
</div>
You want both the
h4andpto bedisplay:inline.h4is by default,display:blockso it’ll take up the whole line. Same goes forp. We can set both of them to inline because theliis displayed as block as well. So everything inside theliis inline but each list item is still displayed as block.See demo here