[ANSWERED] Wrapping Indented Lists (HTML5)

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
paulp575
Rank IV - Intermediate
Posts: 170
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

[ANSWERED] Wrapping Indented Lists (HTML5)

Post by paulp575 »

In the past I've used the combination of

Code: Select all

<ul>
and

Code: Select all

<li>
to display indented lists.

Checking my document that is HTML5 gives me the following tip:
Never use "ul" elements (nor "dl" elements) only to create indentation. This is bad practice, bad for accessibility, and ignores the meaning of the "ul" element. Use CSS to indent and style instead.
I can easily change it to a combination of margin-left-25px and using &bull for the bullet. However, what about an indented line that wraps.

How do I get the indented line to wrap so that the beginning of the wrapped indented line lines up with the text above it? I don't want the wrapped indented line to be even with the bullet. It needs to be indented.
Last edited by paulp575 on Wed Jul 21, 2021 11:56 pm, edited 1 time in total.
paulp575
User avatar
Albert Wiersch
Site Admin
Posts: 3783
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Wrapping Indented Lists (HTML5)

Post by Albert Wiersch »

Hello,

Are you listing things in a bulleted list? In that case it sounds like you are using "ul" properly (to create a list). The message about using the "ul" element to indent is when "ul" is used to indent a paragraph or something else that is not a list.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
paulp575
Rank IV - Intermediate
Posts: 170
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: Wrapping Indented Lists (HTML5)

Post by paulp575 »

Yes, I am using "ul" to indent a list.

So I guess that "tip" I'm seeing is just a reminder; not necessarily a problem.

I always try to ensure all of my web pages are as free as possible from errors/warnings.
paulp575
User avatar
Albert Wiersch
Site Admin
Posts: 3783
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Wrapping Indented Lists (HTML5)

Post by Albert Wiersch »

paulp575 wrote: Wed Jul 21, 2021 5:12 pm Yes, I am using "ul" to indent a list.

So I guess that "tip" I'm seeing is just a reminder; not necessarily a problem.

I always try to ensure all of my web pages are as free as possible from errors/warnings.
Yes, it's just a tip not to use a list element like "ul" to indent... because "ul" is for creating an unordered list, not for indenting. I think this was more of a problem in the past when it was more often used to indent text (or something else) that wasn't actually a list.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply