I want to add bottom padding to the ul
(or to the last li
) that is exactly equal to the computed value of the line-height
property at ul
and li
(they both inherit their line-height
). In other words, I want white space under "Item 3" of the same size as if an "Item 4" li
was added. Is that possible?
Note that em
and rem
units don't achieve this if line-height
is not equal to 1. Also, consider that the "environment" in which the ul
lives is unknown. For example, I don't know if body
has line-height: 1.1
, line-height: 2
, etc.
I want to have the blue space in this image as padding.
This achieves the desired look, but it just feels wrong to have to use pseudo-elements for such a simple use-case.
ul {
list-style: none;
background: #ccc;
}
ul::after {
content: "\00a0";
display: list-item;
}
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>