HTML
  Home arrow HTML arrow Page 2 - Styling Elements of Nested HTML Lists
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Styling Elements of Nested HTML Lists
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-05-22

    Table of Contents:
  • Styling Elements of Nested HTML Lists
  • Review: building basic nested HTML lists
  • Polish the look of nested HTML lists with CSS styles
  • Building a hierarchical navigational system

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Styling Elements of Nested HTML Lists - Review: building basic nested HTML lists


    (Page 2 of 4 )

    If you still haven’t read the preceding article of this series, where I introduced the core concepts for nesting HTML lists, in the next few lines I included the complete source code for a couple of hands-on examples developed in the tutorial. The examples demonstrated how to create these web page elements using different levels of nesting.

    Here are the corresponding code samples:

    (example on building a one-level deep nested list)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title>Example on building multiple nested HTML lists</title>

    </head>

    <body>

    <h1>Example on building multiple nested HTML lists</h1>

    <ul>

    <li>List Item 1

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 2

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 3

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 5

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 6

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 7

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 8

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 9

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 10

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>>

    </li>

    </ul>

    </body>

    </html>


    (example on building a two-level deep nested list)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title>Example on building multiple nested HTML lists</title>

    </head>

    <body>

    <h1>Example on building multiple nested HTML lists</h1>

    <ul>

    <li>List Item 1

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 2

    <ul>

    <li>Sub Item 1

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 3

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    <li>List Item 4

    <ul>

    <li>Sub Item 1</li>

    <li>Sub Item 2</li>

    <li>Sub Item 3</li>

    <li>Sub Item 4</li>

    <li>Sub Item 5</li>

    </ul>

    </li>

    </ul>

    </body>

    </html>


    If you pay close attention to the above code samples, then you’ll realize how simple it is to build nested HTML lists. As you can see, the first case shows the creation of a list that has one level of nesting, while the second example is a bit more complex; it illustrates how to construct a two-level-deep nested list. That was pretty easy to code and follow.

    Now that you have surely grasped the logic that drives creating a few simple nested HTML lists, it’s time to enhance their visual appearance. As I expressed in the introduction, the examples developed so far look pretty skeletal, meaning that it’s necessary to incorporate into them some CSS styles, so they can look a bit more professional.

    Thus, in the upcoming segment I’ll be showing you how to improve via CSS the visual presentation of the nested HTML lists that you learned before. However, to learn the details of how this process will be accomplished, please visit the following section. It’s only one click away.

    More HTML Articles
    More By Alejandro Gervasio


       · This second part of the series shows how to enhance the visual appearance of nested...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek