?
Solved

double ul and li

Posted on 2014-04-19
1
Medium Priority
?
199 Views
Last Modified: 2014-04-19
This is what I want to accomplish:

- 1st item
   - 1st subitem
-second item

When I did the code below, the 1st subitem is indented very far on the inside How do I fix it? Thx
<ul><li>first item </li>
        <ul></li>first subitem</li></ul>
        <li>second item </li>
</ul
0
Comment
Question by:leblanc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 40010454
First of all, your html is wrong.
1) Everything should be closed in the same order it is opened.
2) Nest your sub inside the li
<ul>
    <li>first item 
        <ul>
            <li>first subitem</li>
        </ul>
    </li>
   <li>second item </li>
</ul>

Open in new window

If you want to control the margin of the sub li, you can add css
li li{margin-left:-20px;}

Open in new window

All together
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style>
    li li{margin-left:-20px;}
    
    </style>
</head>
<body>
<ul>
    <li>first item 
        <ul>
            <li>first subitem</li>
        </ul>
    </li>
   <li>second item </li>
</ul>
</body>
</html>

Open in new window

And working sample http://jsbin.com/regeq/1/
0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question