As noted above, all browsers provide the <ul>
parent both margin and padding. While user agents CSS differ somewhat, they all include:
ul,
ol {
/* user-agent styles */
display: block;
list-style-type: disc;
margin-block-start: 1em;
margin-block-end: 1em;
padding-inline-start: 40px;
}
ol {
list-style-type: decimal;
}
li {
display: list-item;
text-align: match-parent;
}
::marker {
unicode-bidi: isolate;
font-variant-numeric: tabular-nums;
text-transform: none;
}
All browsers set padding-inline-start
to 40 pixels for the <ul>
element by default. In left-to-right languages, like English, this is the left padding. Any padding set in the author style sheets (that's your stylesheet) takes precedence.
If you want to be explicit, set the following in your style sheets to ensure, unless otherwise overridden, the list items in the main content area of your document, contained in the <main>
section, are properly indented:
:where(main ol, main ul) {
margin-inline-start: 0;
padding-inline-start: 40px;
}
And always nest your <li>
elements in a <ul>
or <ol>
.