This forum is now read-only. Please use our new forums at discuss.codecademy.com.

42 points
52a1bd6952f8639fde002cbe_547744414
Submitted by
Blest Ent
over 5 years ago

Lists within lists - What am I doing wrong?

Oops, try again. Make sure you have at least one unordered list inside your unordered list of profile sections!

<!DOCTYPE html>
<html>
    <head>
        <title>Tracey Ocean</title>
    </head>
    <body><img src="http://i1135.photobucket.com/albums/m624/Blest_Ent/30f5fc01-5acd-4243-9818-f6f34bf2d5e2_zps29b22f17.gif" border="0" alt=" photo 30f5fc01-5acd-4243-9818-f6f34bf2d5e2_zps29b22f17.gif"/>
    <p> Iam a forty something mother currently residing in Greensboro NC</p>
    <ul>Jobs</ul>
       <ol>
    <li>Accountant</li>
    <li> Domestic Engineer</li>
    <li>Servant of God</li>
    <li> Entrepreneur</li>
        <ol>Businesses
        <li>Blest Creations</li>
        <li>Blest Enterprise</li>
        </ol>
    <li>Mother</li>
    <ol>Hobbies</ol>
    <li>Crafts</li>
        <li>Beading</li>
        <li>Sewing</li>
    </body>
</html>

53 votes

permalink

This is a concept that throws everyone off, at first, until we get a closer look at it...

First, let's discuss the unordered list, <ul></ul>, and the ordered list, <ol></ol>. Both of these elements do not take plain text or any element other than <li></li>. So,

<ul>Jobs</ul>
<!-- and -->
<ol>Businesses

are both invalid HTML. Consider this example:

<ul>
    <li>Red</li>
    <li>Green</li>
    <li>Blue</li>
</ul>

This will print a list on three lines that look something like this:

  • Red
  • Green
  • Blue

and this,

<ol>
    <li>Red</li>
    <li>Green</li>
    <li>Blue</li>
</ol>

will print a numbered list, like so,

  1. Red
  2. Green
  3. Blue

That's the basic list. Now let's look at nesting. List item elements, <li></li>, are block elements, and as such may contain other blocks, including UL and OL. The key is to 'contain' them in the parent LI.

<ul>
    <li>Jobs
        <ul>
            <li>Accountant</li>
            <li>Domestic Engineer</li>
            <li>Entrepreneur</li>
        </ul>
    </li>
    <li>Businesses
        <ol>
            <li>Blest Creations</li>
            <li>Blest Enterprise</li>
        </ol>
    </li>
</ul>

Study this example and you should be able to repair your markup so it works.

8799 points
5958b8ebe12813a2a3000034_980106998
Submitted by
Roy
over 5 years ago

32 Comments

52405949987f065963c7216160bfe4ba?s=140&d=retro MogulGraphics over 5 years ago

this helped me out a lot thank you

52b26f62631fe968280009c3_69961764 Sean K. about 5 years ago

I tried to do this, but with . Is that wrong?

5958b8ebe12813a2a3000034_980106998 Roy about 5 years ago

CSS depends upon well formed HTML to be effective. Otherwise you're brute forcing things into position and creating a schmoz. Best to use the built in list tools, and make fine tuning adjustments 'to tame, rather than tackle' the list.

52c39a6f9c4e9db0a800383d_117641844 snehal about 5 years ago

thanku

5958b8ebe12813a2a3000034_980106998 Roy about 5 years ago

The beauty of lists is that they give us so many hooks. We may not be able to do much with the HTML, but CSS opens a whole world to us, and lists help us explore it.

52da8a9b8c1cccfa18002101_442490564 estrellaetoile about 5 years ago

Thanks. This did the trick!

4d394eedc14587c21dbfe8b59b6c8da4?s=140&d=retro 13heenakhan about 5 years ago

Not working Please help

C72c5fc226bafb032d935f0b94166f54?s=140&d=retro rohan49 about 5 years ago

It din't work for me as well:(

3dbb037e14c0c79132677261732f58d2?s=140&d=retro ajgal22 about 5 years ago

Try changing one of the tags into , and it will work.

5c8a5e2750c9d8f27d7af05196a9c330?s=140&d=retro whxyszl almost 5 years ago

I change one of the ol tag into ul,it worked.

5958b8ebe12813a2a3000034_980106998 Roy almost 5 years ago

The above is not the answer, but an example. Follow the instructions given in the lesson exercise.

A331ca02de6590ae139185a579de19de?s=140&d=retro Ethan Ikpeama over 4 years ago

i did exactly this but it was not accepted

5958b8ebe12813a2a3000034_980106998 Roy over 4 years ago

Be sure one of the nested lists is an UL. I've edited the above to show this.

833685575da64099809678e30fe83c03?s=140&d=retro Exturbo_53c458967c82ca53fe002acd_del over 4 years ago

Roy, this helped me a lot, but shouldn't the maker of the exercise be made aware that the instructions aren't really clear? I get it now but "Go nuts with your lists within lists! The only requirement is that you have at least one ordered list() and one unordered list ()." doesn't get the point across that you need an ordered list and unordered list nested. I saw this and then reviewed the "Stuck? Get A Hint!" and it did show a unordered list nested in a unordered list, but again, the instructions themselves were not too clear.

Picture Donaldy over 4 years ago

thank you for helping

8edd5cfbb0fade26b563ffdb0efbd44a?s=140&d=retro LuckyMike over 4 years ago

Thanks :D

541a6c2b9c4e9d8d9c001396_699545674 Jasmine Stanley over 4 years ago

Thank you! This was extremely helpful and I agree with Zach, the instructions weren't really clear.

545658668c1ccc0e93004f9c_952407975 Nurul Hidayati over 4 years ago

I try to change for and too, and its work... thanks for helping...

Picture Tobias Williams over 4 years ago

It's more that the question is poorly worded, it implies that you need to add a nest ol, not both a nested ol and a nest ul.

5472bba37c82cadff2006739_111572462 Robert Connelly over 4 years ago

Thank you Roy. The coding given didn't make sense, your's did.

5703940c5917ecbfcc0003b2_537713534 supercool12 about 4 years ago

I had the same problem!

Acb381730327a62f0cac3d1857ff3645?s=140&d=retro hadeel103 about 4 years ago

I was stuck on this for ages! Thank you so much you really helped.

Bfcfdc5919e88da6b9c7fa89c6e07c86?s=140&d=retro grace mason almost 4 years ago

Oh my god thank you i had so much trouble with this

C65f3e47f0f262b0c3fdf3bdc8ca42fb?s=140&d=retro Matthew Poulton almost 4 years ago

Same - thank you very much!! =)

Ab7dddfeb23e42d68cd6306111e07402?s=140&d=retro HalimaJahanMuskan almost 4 years ago

thanks a lot!!!!.....

9691cafe31336a4d8f94eefb8a42e36b?s=140&d=retro Sophie Cooper almost 4 years ago

Thanks so much!

4b6d3995ce0dc7a38ea02e20b45e4f37?s=140&d=retro zdanielbutler almost 4 years ago

Thanks!

97a14215231e0d5899e470f09e0a0738?s=140&d=retro Mr_Programmer007 almost 4 years ago

Thanks!!

76f9f6889ea64227c3fc6e25b5e51a24?s=140&d=retro misnosaginah over 3 years ago

thank you for your answer,,, from indonesia

2c4cb46347cb007c08084d78b9335f5b?s=140&d=retro Maria Lucia Rodriguez CastaƱo over 3 years ago

Thanks!!!

Picture JenPotpot Clarin Sapitula over 3 years ago

thank you!

Ef344a7e394080df0a8e43c560197986?s=140&d=retro Carl Laguerre over 3 years ago

thanks!


2 votes

permalink

Hi, please help.
If I make a -ol- inside the -ul- theres the message: "Oops, try again. Make sure you have at least one unordered list inside your unordered list of profile sections! "

OK, so I did that (-ul- inside -ul-) and the message now "Oops, try again. Make sure you have at least one ordered list inside your unordered list of profile sections! " ... !???
So how can I solve the problem?

158 points
4ace702b9e1afe2736d96d91909bda80?s=140&d=retro
Submitted by
Erhard
about 5 years ago

4 Comments

5958b8ebe12813a2a3000034_980106998 Roy about 5 years ago

The only valid direct children for UL or OL are LI. Study the above example. Notice that the inner list is wholly contained in one LI? The LI is the parent of the nested list.

E0ee962933009fae0e9af1ced0d4fb0e?s=140&d=retro Jamie about 5 years ago

Finally figure it out. Make an ordered list for your "interests" then create and unordered list for you "jobs". I guess it wants you to create one of both. Kind of confusing.

Picture Tiffany Katherine Weir almost 5 years ago

This is exactly it, I had everything right but until I added both a OL and an UL it didn't work.

53710fee631fe9c55d000cab_731069930 Connie almost 5 years ago

Until I did what Erhard did I couldn't get rid of that message either. Maybe something is wrong beyond our control. I think so. I need to move forward and trying figure out why it doesn't work as it should is beyond my expertise.


2 votes

permalink

It's worse than any comments so far. The instructions ask for one thing but the auto-grader looks for something different. So even working code that follows the instructions doesn't pass.

The instructions say:
"Go nuts with your lists within lists! The only requirement is that you have at least one ordered list() and one unordered list ()."

The error says:
"Oops, try again. Make sure you have at least one unordered list inside your unordered list of profile sections!"

I hope someone from code academy is watching!

411 points
3b60b4029a97bfc2d7efd2e891cb3b5c?s=140&d=retro
Submitted by
MTCA
almost 4 years ago


1 vote

permalink

This worked for me, ugh!!

You have to have one ol with one ul inside it.
The tricky part is, you have to have one ul with both and ol and an ul inside it.

<!DOCTYPE html>


Elain Stritch



I'm Elain Stritch. I live in New York City. I am from a small town in the south. I am very old. And I am very tired of being old.

          <h1>About Me</h1>
    <ol>Places I've lived
        <li>New York
            <ul>Places I've lived in NYC
                <li>Manhattan</li>
                <li>Brooklyn</li>
                <li>Queens</li>
            </ul>
        </li>
        <li>San Francisco</li>
        <li>Seattle</li>
        <li>Washington DC</li>
    </ol>

    <ul>Things I like to do
        <li>Perform</li>
        <li>Read
            <ul>Types of books I read
                <li>Fiction</li>
                <li>Non-fiction</li>
                <li>Memiors</li>
            </ul>
        </li>
        <li>Walk
            <ol>Places I walk in NYC
                <li>Manhattan</li>
                <li>Brooklyn</li>
                <li>Queens</li>
            </ol>
        </li>
        <li>Drink</li>
    </ul>
</body>

321 points
53bd99319c4e9de1c1000281_650859749
Submitted by
Phoebe Sanna
over 4 years ago


1 vote

permalink

Its asking for an unordered inside an unordered. I fell pray to the silly jump backwards in teaching also. I was working in ordered lists, then all of a sudden they ask for another unordered list again.

There is often rather verbose errors, you sometimes have to read them a few times to follow, they are poorly implemented.

So

<ul>
    <li>Outer Unordered
        <ul>
           <li>Inner Unordered</li>
        </ul>
    </li>
<li> 
    <ol>
       <li>Inner Ordered</li>
   </ol>
</li>
</ul>

998 points
Picture
Submitted by
Stephen Davies
over 4 years ago


0 votes

permalink

Try to read the error warning carefully. This code should solve the problem:

     //creating unordered list - this will wrap all of sub-unordered list and sub-ordered list 
     <ul>
           //creating sub- unordered list
        <li>Item 1 
            <ul>
                <li>sub item 1.1</li>
                <li>sub item 1.2</li>
             </ul>
        </li>
           //creating sub-ordered list
        <li>Item 2
            <ol>
                <li>sub item 2.1</li>
            </ol>
        </li>
    </ul>

201 points
5364afc09c4e9dba37001238_723483508
Submitted by
dothewhatnot
almost 5 years ago