Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Ordered List best practice

Writing the markup for an auto parts website. Going to use an information chart that correlates a certain vin code to production month. The codes are in alphabetical order, but skip some letters for whatever reason. I wonder if I'm going about things the wrong way. I haven't touched CSS for this website yet.

My IDE alerts me that the "type" attribute on the "ol" element is obsolete. Use CSS instead.

How should I generate this ordered list then? The intent is two columns. Here is the codepen.

<ol type="A">
<li>January</li>
<li>February</li>
<li>March</li>
<li>April</li>
<li>May</li>
<li value="8">June</li>
</ol>
<ol type="A">
<li value="11">July</li>
<li value="13">August</li>
<li value="16">September</li>
<li value="18">October</li>
<li>November</li>
<li>December</li>
</ol>

1 Answer

Brandon Flade
Brandon Flade
2,769 Points

HTML should look like this:

<ol class="upper-alpha">
<li>January</li>
<li>February</li>
<li>March</li>
<li>April</li>
<li>May</li>
<li value="8">June</li>
</ol>
<ol class="upper-alpha">
<li value="11">July</li>
<li value="13">August</li>
<li value="16">September</li>
<li value="18">October</li>
<li>November</li>
<li>December</li>
<ol>

CSS should look like this:

ol.upper-alpha {list-style-type: upper-alpha;}

Okay so basically the same markup, just be sure to use the list-style-type attribute. Good! Thanks for this advice.

James Barnett
James Barnett
39,199 Points

Richard Rakin - Understanding the reason you do it this way is pretty important.

HTML is about structure not presentation so you shouldn't use any tags that don't have a semantic meaning. type = "A" doesn't describe the type of data that goes into a list, merely how to present that data on the screen.