Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2009, 03:27 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default How to make a nested list tag that is valid?

Hi

I am trying to do an ordered list that has a unordered sub list. I am not sure how to do this. By searching I found that I should put the new unordered list in an <li> tag or the ordered list.

I get the problem then of having the sub list getting a number.

Like

1. A
2 . B
. C
. D
3. E

So I tried to do a list-style none on just the "2" tag but then it does not recount the remaining ones. I would just hide the "2" and that looks weird.

So I am assuming there is some sort of CSS solution to this problem? That is keeps the html still valid?

Thanks
 
Old April 21st, 2009, 04:07 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

You might show us an example of the code you're using; the description you give is certainly correct and I've used it extensively. It's solid web standards way of programming and believe me, will make your code more maintainable down the road. Here's the syntax I would use. If you have any trouble, check back.

Code:
<ol>
     <li>
          This is the 1st item in the main list.
     </li>
     <li>
          This is the 2nd item in the main list. Note how it is inside the li tags of the main list, but outside the nested list. This will create the effect of having the unordered nested list appear below the 2nd item in the main list (presumably providing additional details.
          <ul>
               <li>
                    This is the 1st item in the nested list. Note how the entire nested list comes after the opening li tag of the 2nd item in the main list, but before the closing tag of the 2nd item in the main list.
               </li>
               <li>
                    This is the 2nd item in the nested list.
               <li>
          </ul>
     </li>
     <li>
          This is the 3rd item in the main list.
     </li>
</ol>
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
extract nested list JohnBampton XSLT 3 February 26th, 2009 06:14 AM
List of valid domain extensions madhukp Classic ASP Basics 5 August 16th, 2008 10:35 AM
Nested Bullet List tims XSLT 1 May 8th, 2008 06:37 AM
Creating a list depending on a tag value josephine XSLT 1 October 26th, 2007 05:39 AM
How to get a list of specific tag from xml using v JelfMaria XML 4 January 13th, 2005 09:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.