Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Akwa Dike
4,286 PointsPlease help with challenge "Add a nested ordered list to the "Shapes" list item" 5/6
this is what i typed
<ul>
<li>Shapes</li>
<ol>
<li>triangle</li>
<li>triangle</li>
</ol>
<li>Colors</li>
</ul>
But why does it keep coming out wrong, so could someone just give me the solution ive been on this for days.
2 Answers
Vijay Rangan
7,543 PointsBasically you're telling the browser that the following "ordered list <ol>" should be "nested" or "included" inside of the parent "li" list item. By putting a /li even before the ordered list starts, the browser understands that line of code as saying "Hey, I'm done with this list item. Nothing else comes with it". But by "wrapping" it inside of the opening li and the closing /li, you're telling the browser, "Listen, I want the ordered list below to be nested inside of my list item".
That rule can be applied to all html elements. For example, take div tags. div always nest other html tags inside of them. Take a look below:
<div class="container">
<h1>This is a H1 heading</h1>
<p>This is a paragraph</p>
</div>
This div tag call the ".container" class and nests a h1 and a p tag. The same logic works for lists.
Hope that helps!
Andy Crofford
9,959 PointsYou have to move the closing list tag down below the closing tag for the ordered list within shapes.
<ul>
<li>Shapes
<ol>
<li>triangle</li>
<li>triangle</li>
</ol>
</li>
<li>Colors</li>
</ul>
Akwa Dike
4,286 Pointsthanks so much but why?
Andy Crofford
9,959 PointsI am trying to think of a good example. Say you wanted to put a link inside a paragraph.
You would do
<p>This is paragraph text</p><a href="*">This is the link.</a>
You would do
<p>This is a <a href="#">link</a> inside a paragraph</a></p>
Does that make any sense?
Andy Crofford
9,959 PointsThe first one should be "You wouldn't do:"
<p>This is paragraph text</p><a href="*">This is the link.</a>
Akwa Dike
4,286 PointsAkwa Dike
4,286 Pointsthank you very much... actually helped alot