Solved

double ul and li

Posted on 2014-04-19
1
192 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
1 Comment
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
.Net Web Site Password specs 2 19
Menu Inconsistent 3 18
Flexbox in CSS3 2 25
(URGENT) Help HTML and CSS Resizing Images 2 19
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now