SunQuest
 
       Web Standards
  Home arrow Web Standards arrow Page 5 - Get Down With Markup
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  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
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? 
WEB STANDARDS

Get Down With Markup
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 9
    2005-02-15

    Table of Contents:
  • Get Down With Markup
  • Quiz time
  • Method B: The bullet that bites
  • Method C: Getting closer
  • Method D: Wrapper’s delight
  • Extra credit
  • Getting fancier with custom bullets
  • Lists that navigate
  • Mini-tab shapes

  • 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
     
    Iron Speed
     
    ADVERTISEMENT

    Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!

    Get Down With Markup - Method D: Wrapper’s delight


    (Page 5 of 9 )

      <ul>
      <li>Apples</li>
      <li>Spaghetti</li>
      <li>Green Beans</li>
      <li>Milk</li>
      </ul>

    So what makes Method D so special? First and foremost, it’s completely valid. A proper unordered list has a containing <ul>
    element, with each item within wrapped in opening and closing <li> elements. Now just when you think all we’re going for here is demonstrating how to be valid for valid’s sake, we’ll take a look at it in action.

    Because we’ve properly marked up our grocery list, each item will be on a separate line (due to the block-level nature of the <li> and most visual browsers will render a bullet next to each item, as well as indent any wrapping lines that may occur (see Figure 1-3).

      

    Figure 1-3.  Default rendering of an unordered list

    Users of PDAs, phones, or other small-screened devices will also be able to view the list in a similar, clearly organized fashion. Because we’ve told the device what the data is (a list in this case), it can best decide how to display it according to its capabilities.

    If a long line wraps due to increased text size or a narrow browsing window, the wrapped line will appear indented to line up with the text above it. It’ll be darn clear to distinguish between items no matter what the browsing circumstances.

    Summary

    Now that I’ve picked each possible method apart, let’s quickly review what I’ve covered about each:

    Method A:

    • Leaves out the possibility for styling the list uniquely
    • Could create confusion when longer lines wrap in a narrow column or small-screened device
    • Lacks semantic meaning

    Method B: 's ch

    • Adding a bullet helps for signifying a new item, but some browsers may choose not to show it, without its parent <ul> element.
    • No containing <ul> element or closing <li> elements means difficult to style.

    Invalid.Method C:

    • Closing the </li> element eliminates the need for <br />
      tags.
    • Omitting the <ul> element makes it difficult to style this particular list differently.
    • Invalid.

    Method D:

    • Valid!
    • Provides semantic meaning and structure.
    • Bullets will render to the left of each item on most browsers.
    • Wrapping lines will indent on most browsers.
    • It can be easily styled uniquely with CSS.

    As you can see, you can learn a lot from a seemingly innocent little question. Even if you’re already using Method D exclusively on all of your pages, it’s nice to know why you do things the way you do. We’ll continue to explore such “why” questions throughout the book, giving you more ammunition to make the best choice at the right time.

    This chapter is from Web Standards Solutions: The Markup and Style Handbook by Dan Cederhold (Apress, 2004, ISBN:  1590593812). Check it out at your favorite bookstore today. Buy this book now.

    More Web Standards Articles
    More By Apress Publishing


     

    WEB STANDARDS ARTICLES

    - Completing a Configuration for Chrome and a ...
    - Getting Connected with Firefox and Chrome
    - Configuring Servers and Databases with Chrome
    - Configuring Firefox for Chrome and a Server
    - Designing the Elements of a Web Page
    - Matching div heights with CSS and JavaScript
    - Forms
    - Get Down With Markup
    - If I Said You Had a Beautiful Body...
    - Web Standards in Dreamweaver Part 3
    - Web Standards in Dreamweaver, Part 2
    - Web Forms
    - Making Lists Using XHTML
    - Web Standards in Dreamweaver, Part 1


    Iron Speed





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway