Why Are My List Items Shifting After a CSS Reset, and How Can I Fix the Alignment?

Mary-Kate Olsen
Release: 2024-11-25 21:53:12
Original
634 people have browsed it

Why Are My List Items Shifting After a CSS Reset, and How Can I Fix the Alignment?

List Items Shifting After CSS Reset: Aligning Second Lines with Bullets

After employing a CSS reset, several users have encountered an issue where the second lines of text within list items (li) begin below the bullet after a wrap. This visual misalignment can be corrected by adjusting the list-style-position property of the li tag, setting it to "outside."

However, this solution can lead to indentation issues with the bullets. To address this, an additional margin property can be applied to the ul parent element, ensuring alignment with the text outside the list.

Updated Solution (March 15, 2014):

ul {
  list-style-position: outside;
  margin-left: 1em;
}
Copy after login

This code provides a more refined solution, addressing the aforementioned indentation issue and improving readability. The margin property is applied to the ul element, ensuring that the entire list is indented, maintaining proper alignment with the text outside of the list.

The above is the detailed content of Why Are My List Items Shifting After a CSS Reset, and How Can I Fix the Alignment?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template