I'm facing an issue while trying to implement a numbered list, where each li
contains a segment of the Foundation 5.5.3 grid.
The problem arises when there is unwanted space above the child grid columns within the li
elements.
Example:
Upon investigation, I discovered that this spacing issue is caused by a CSS rule in Foundation that applies
content: " "; display: table;
on the ::before
pseudo-element of the row.
https://i.sstatic.net/ghs7m.png
Attempting to override or remove this rule affects the row's spacing, leading to undesired results.
I have experimented with removing the row
class from the li
and using a child div.row
, but the issue persists.
To summarize, I aim to create a two-column grid within each li
of a numbered list (ol/ul
), yet encounter vertical space at the top of each li
. How can I eliminate this space, or should I consider an alternative strategy for achieving this grid structure within multiple li
s?
Thank you.
Example:
li {
background-color: #ddd;
padding: 5px;
}
li + li {
margin-top: 5px !important;
}
li > span {
background-color: yellow;
}
/* Trying to override ::before and ::after on .row */
.row.psuedo-override::before, .row.psuedo-override::after {
content: none !important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.3/css/foundation.css" rel="stylesheet"/>
<div class="row">
<div class="small-12 columns">
<h1>My List</h1>
<h5><kbd>li</kbd> tags are <kbd>"row collapse"</kbd></h5>
<ol>
<li class="row collapse">
<span class="small-9 columns">Some long text goes here that should wrap to the next line if it is sufficiently long enough which this should qualify</span>
<span class="small-3 columns text-right">$100</span>
</li>
<li class="row collapse">
<span class="small-9 columns">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent nulla mauris, iaculis vel ante eget, vestibulum ornare est. </span>
<span class="small-3 columns text-right">$50</span>
</li>
<li class="row collapse">
<span class="small-9 columns">Phasellus quis odio ac sapien congue aliquam sit amet ornare magna. Quisque consequat mauris nec turpis finibus, id bibendum dolor tincidunt.</span>
<span class="small-3 columns text-right">$75</span>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="small-12 columns">
<h1>My List</h1>
<h5><kbd>li</kbd> tags are <kbd>"row collapse"</kbd>, with no psuedo content. Vertical height gets messed up though...</h5>
<ol>
<li class="row collapse psuedo-override">
<span class="small-9 columns">Some long text goes here that should wrap to the next line if it is sufficiently long enough which this should qualify</span>
<span class="small-3 columns text-right">$100</span>
</li>
<li class="row collapse psuedo-override">
<span class="small-9 columns">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent nulla mauris, iaculis vel ante eget, vestibulum ornare est. </span>
<span class="small-3 columns text-right">$50</span>
</li>
<li class="row collapse psuedo-override">
<span class="small-9 columns">Phasellus quis odio ac sapien congue aliquam sit amet ornare magna. Quisque consequat mauris nec turpis finibus, id bibendum dolor tincidunt.</span>
<span class="small-3 columns text-right">$75</span>
</li>
</ol>
</div>
</div>