Looking to remove the padding-inline-start of an ol (or ul) block? Here are some ways I have experimented with:
div {width:300px;}
#d2 ol {padding:0}
#d3 ol {list-style-position:inside;padding:0}
#d4 ol {padding:1em}
#d5 ol {padding-inline-start:20px}
<h2>1. Default CSS</h2>
<div id="d1">
<p>Normal text</p>
<ol>
<li>List item</li>
<li>Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...</li>
</ol>
<p>Normal text</p>
</div>
<h2>2. Padding 0</h2>
<div id="d2">
<p>Normal text</p>
<ol>
<li>List item</li>
<li>Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...</li>
</ol>
<p>Normal text</p>
</div>
<h2>3. Padding 0 + List Style Position Inside</h2>
<div id="d3">
<p>Normal text</p>
<ol>
<li>List item</li>
<li>Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...</li>
</ol>
<p>Normal text</p>
</div>
<h2>4. Padding 1em</h2>
<div id="d4">
<p>Normal text</p>
<ol>
<li>List item</li>
<li>Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...</li>
</ol>
<p>Normal text</p>
</div>
<h2>5. Padding-inline start 20px</h2>
<div id="d5">
<p>Normal text</p>
<ol>
<li>List item</li>
<li>Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...Lite item... longer text...</li>
</ol>
<p>Normal text</p>
</div>
Curious about the best approach to achieving this goal?
Note on potential drawbacks for each method:
1. Padding 0
This results in pushing the entire block outside the view, which is not ideal.
2. Padding 0 + List Style Position Inside
While it aligns the left edge perfectly, the text wrapping around the bullets/digits may not look visually appealing.
3. Padding 1em
Offers a very good appearance, but uncertainty remains regarding whether 1em
is the most suitable solution due to being an estimation.
4. Padding 20px
Similar to the previous padding 1em
solution, with 20px
being another estimate as the default value is 40px (for ul and ol).