Solved

How do I create nested order lists with style type?

Posted on 2014-09-16
7
105 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 21

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 21

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 21

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 21

Accepted Solution

by:
Kim Walker earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Column Spacing 3 36
HTML5 and Javascript 3 36
Modify Table Width 6 13
After moving to webstite page stopped working 7 40
Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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…

705 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

20 Experts available now in Live!

Get 1:1 Help Now