Is there a way to indent each list-item using CSS?
So a normal list:
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
</ul>
Displays like so:
One
Two
Three
Four
Is there a way to indent each list-item using CSS?
So a normal list:
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
</ul>
Displays like so:
One
Two
Three
Four
If you have a lot of
list-items
,then the answer given by @Banzay is cleaner, but if you just have few of them, you can usenth-child
for thatHere you can use
:before
pseudo-element with transparent border. You can variate indent of list item by changing a width of pseudo-element. Along with that you can change list marker if setlist-style: none;
and setcolor
ofcontent
EDIT:
removed
display: block
andcolor: transparent
and used space character\00a0
as a content.The following one is little more complex with changed list marker (removed
display: block
as advised by @dippas, butborder-top
insteadborder
didn't work for some reason)