Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I create nested order lists with style type?

Posted on 2014-09-16
7
Medium Priority
?
114 Views
Last Modified: 2014-09-17
How do I do this? Nested <ol><li> styles don't seem to work. Is this not possible with ordered and unordered lists? They all render out as upper-alpha.

A. bla bla bla bla bla bla bla bla bla bla bla bla

B. bla bla bla bla bla bla bla bla bla bla bla bla

   1. bla bla bla bla bla bla bla bla bla bla bla bla

   2. bla bla bla bla bla bla bla bla bla bla bla bla

   3. bla bla bla bla bla bla bla bla bla bla bla bla
      a. bla bla bla bla bla bla bla bla bla bla bla bla

      b. bla bla bla bla bla bla bla bla bla bla bla bla

C. bla bla bla bla bla bla bla bla bla bla bla bla

ol.decimal {
  margin: 0px;
}
	
ol.decimal li {
  list-style-type: decimal;
  margin: 6px 0px;
}
	
ol.upper-alpha {
  margin: 0px;
}
	
ol.upper-alpha li {
  list-style-type: upper-alpha;
  margin: 6px 0px;
}

Open in new window


<ol class="upper-alpha">
<ol class="decimal">
<ol class="lower-alpha">

<ol class="upper-alpha">
	<li>
		bla bla bla bla bla bla bla bla
	</li>
	<li>
		bla bla bla bla bla bla bla bla
		<ol class="decimal>
			<li">
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
 				<ol class="lower-alpha">
					<li>
						bla bla bla bla bla bla bla bla
					</li>
					<li>
						bla bla bla bla bla bla bla bla
					</li>
				</ol>
			</li>
			<li>
			     bla bla bla bla bla bla bla bla
			</li>
				</ol>
			</li>
		</ol>

Open in new window

0
Comment
Question by:kadin
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:Kim Walker
ID: 40327918
There's very little that you need to change here. Except for a poorly place quote mark on line 12 that belongs on line 11, your list-style-type declarations should be part of the ol style, not the li style.
ol.decimal {
  list-style-type: decimal;
  margin: 0px;
}
	
ol.decimal li {
  margin: 6px 0px;
}
	
ol.upper-alpha {
  list-style-type: upper-alpha;
  margin: 0px;
}
	
ol.upper-alpha li {
  margin: 6px 0px;
}

ol.lower-alpha {
	list-style-type: lower-alpha;
}

Open in new window

<ol class="upper-alpha">
	<li>
		bla bla bla bla bla bla bla bla
	</li>
	<li>
		bla bla bla bla bla bla bla bla
		<ol class="decimal">
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
 				<ol class="lower-alpha">
					<li>
						bla bla bla bla bla bla bla bla
					</li>
					<li>
						bla bla bla bla bla bla bla bla
					</li>
				</ol>
			</li>
			<li>
			     bla bla bla bla bla bla bla bla
			</li>
		</ol>
	</li>
</ol>

Open in new window

0
 

Author Comment

by:kadin
ID: 40328834
Thanks for your help. I tried what you said. I have tried different combinations. I can only get it to work on two levels, but not three.

Here is what I get.
A.
B.
    1.
    2.
        1.
        2.

Here is what I want.
A.
B.
    1.
    2.
        a. or these could be squares, which I could not get to work either.
        b.
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 40328847
I failed to mention in my previous post that you omitted the style definition for lower-alpha in the css you posted. I added it to the style definitions in my previous comment on lines 19-21. Did you overlook that?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 22

Expert Comment

by:Kim Walker
ID: 40328875
Another way you could define this in css would be to use nested selectors. This way you don't have to worry about adding classes or getting confused and adding the wrong class
ol { list-style-type: decimal; margin: 0px; }
ol li ol { list-style-type: upper-alpha; margin: 0px; }
ol li ol li ol { list-style-type: lower-alpha; }
ol li { margin: 6px 0px; }

Open in new window

<ol>
	<li>
		bla bla bla bla bla bla bla bla
	</li>
	<li>
		bla bla bla bla bla bla bla bla
		<ol>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
			</li>
			<li>
				bla bla bla bla bla bla bla bla
 				<ol>
					<li>
						bla bla bla bla bla bla bla bla
					</li>
					<li>
						bla bla bla bla bla bla bla bla
					</li>
				</ol>
			</li>
			<li>
			     bla bla bla bla bla bla bla bla
			</li>
		</ol>
	</li>
</ol>

Open in new window

Rendering of above HTML
0
 

Author Comment

by:kadin
ID: 40328918
I don't think I forgot anything. I will try your second suggestion in a couple of hours.

ol.lower-alpha {
                list-style-type: lower-alpha;
		margin: 0px;
	}
	
	ol.lower-alpha li {
		margin: 6px 0px;
	}
	
	ol.upper-alpha {
                list-style-type: upper-alpha;
		margin: 0px;
	}
	
	ol.upper-alpha li {
		margin: 6px 0px;
	}
	
	ol.decimal {
                list-style-type: decimal;
		margin: 0px;
	}
	
	ol.decimal li {
		margin: 6px 0px;
	}

Open in new window

0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 2000 total points
ID: 40328934
Your styles work fine for me. Can you post a link to your entire page? There could be other styles that are conflicting with these.
0
 

Author Closing Comment

by:kadin
ID: 40329118
That was it. It is working now. This must of had something to do with it. When I disable this, it works.
li {
 list-style-type: none;
}

Thanks for your help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

824 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