Solved

html - 'li' controls cannot be nested within a <div> tag

Posted on 2011-03-16
4
856 Views
Last Modified: 2012-05-11
Okay im trying to make bullets..if I can use the <li></li> list tages,,,then what can I use..?
0
Comment
Question by:GlobaLevel
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
AriMc earned 500 total points
ID: 35152376
What do you mean they can't be nested? Try this:

<div>
<ul>
   <li>a</li>
   <li>b</li>
   <li>c</li>
   <li style="{list-style:none}">
      <ul>
         <li>1</li>
         <li>2</li>
         <li>3</li>
      </ul>
   </li>
<ul>
</div>

Open in new window

0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 35152619
The LI tag is a "list item".  The UL and OL tags are "unordered list" and "ordered list" respectively.  In HTML, a list is made up of list items.  The rule is this:

1) UL and OL can only have one type of child node: LI
2) The LI node can only exist immediately underneath an OL or UL node
3) You can put ANYTHING inside a LI node

This is valid:
<ul>
  <li><a href="#">Link 1</a></li>
  <li><a href="#">Link 2</a></li>
  <li>
    <a href="#">Link 3</a>
    <ol>
      <li><a href="#">Link 3-1</a></li>
      <li><span>Text inside a span</span></li>
    </ol>
  </li>
  <li>
    <div>Some text here</div>
  </li>
</ul>
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 35152648
Also, if you are using a CSS RESET stylesheet, then you will need to add this to your site stylesheet to get your bullets and formatting back.

ul {
  padding: 1em;
  list-style: disc outside none;
}
li {
  margin-left: 2em;
}
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35152727
Yes Iam using CSS...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

790 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