Removing Indentation from Unordered Lists: Is Negative Text-Indent the Only Solution?
The question arises: how to eliminate all indentation from an unordered list element (ul), despite attempts to set margin, padding, and text-indent to 0. While setting text-indent to negative values seems to do the trick, is it the only way?
The answer lies in setting the list style and left padding to nothing. By implementing the following code, you can achieve the desired effect:
ul { list-style: none; padding-left: 0; }
This code removes the indentation by eliminating the default list style and resetting the left padding to 0. Here's an example to illustrate the outcome:
<ul> <li>a</li> <li>b</li> <li>c</li> </ul>
In this case, the unordered list items will be displayed without any indentation.
The above is the detailed content of Is Negative Text-Indent the Only Way to Remove Indentation from Unordered Lists?. For more information, please follow other related articles on the PHP Chinese website!