A regular list
This is a regular list that serves as the basis of my question.
div {
background: lightgreen;
width: 15em;
margin-left: auto;
margin-right: auto;
font-size: 2em;
}
<div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse in pretium mauris. Aliquam ultrices ipsum sit amet auctor porta. Donec et metus quis dolor dignissim euismod non a sem. Sed accumsan risus quis ipsum pellentesque, quis dictum metus porttitor.</li>
<li>Etiam et interdum ipsum, quis venenatis augue. Sed euismod, sem eget tristique molestie, arcu massa scelerisque nunc, eget scelerisque elit sem vitae nulla.</li>
<li>Nulla id</li>
<li>Nam ut</li>
</ul>
</div>
The font-size is blown up to 2em
so that we can clearly see additional unwanted space around the bullet points in proposed solutions.
Setting left-padding to 0 does not solve it completely
I want to align the discs (the bullets) of the list with the left edge of the div
element. So I try something like this.
div {
background: lightgreen;
width: 15em;
margin-left: auto;
margin-right: auto;
font-size: 2em;
}
ul {
padding-left: 0;
list-style-position: inside;
}
<div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse in pretium mauris. Aliquam ultrices ipsum sit amet auctor porta. Donec et metus quis dolor dignissim euismod non a sem. Sed accumsan risus quis ipsum pellentesque, quis dictum metus porttitor.</li>
<li>Etiam et interdum ipsum, quis venenatis augue. Sed euismod, sem eget tristique molestie, arcu massa scelerisque nunc, eget scelerisque elit sem vitae nulla.</li>
<li>Nulla id</li>
<li>Nam ut</li>
</ul>
</div>
This solution would have been nice if the indentation of the wrapped lines were not lost. I still want the wrapped lines to be aligned with the beginning of the first character of the first line like they are in a regular list.
Setting left-padding to 1em does not solve it completely
This is one of the solutions proposed in the answers but this does not work as well. We can see additional horizontal space between the left edge of the DIV and the bullet-point discs.
div {
background: lightgreen;
width: 20em;
margin-left: auto;
margin-right: auto;
font-size: 2em;
}
ul {
padding-left: 1em;
}
<div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse in pretium mauris. Aliquam ultrices ipsum sit amet auctor porta. Donec et metus quis dolor dignissim euismod non a sem. Sed accumsan risus quis ipsum pellentesque, quis dictum metus
porttitor.</li>
<li>Etiam et interdum ipsum, quis venenatis augue. Sed euismod, sem eget tristique molestie, arcu massa scelerisque nunc, eget scelerisque elit sem vitae nulla.</li>
<li>Nulla id</li>
<li>Nam ut</li>
</ul>
</div>
Question
What is the right way to solve this problem?