5, December 2008

To <ul ="navlist"> or not to <ul ="navlist"> - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design  >  CSS (Moderator: Meth0d)
Topic: To <ul ="navlist"> or not to <ul ="navlist">
« previous next »
Pages: [1] Print

Author Topic: To <ul ="navlist"> or not to <ul ="navlist">  (Read 254 times)
Google dot what?
*
Gender: Male
Posts: 2
20 credits
Members referred : 0



« on: Jul 27, 2008, 07:31:06 PM »

As I've looked at various CSS files for the layouts of websites, I've noticed that some have a list set up as:

<div id="navcont")
<ul id="navlist">
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
</ul>
</div>

Yet others have the list without the id "navlist" in the <ul>.

<div id="navcont")
<ul>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
<li><a href="*">Link</a></li>
</ul>
</div>


To me, it seems like extraneous code to have a separate id in with the <ul>. Is there an advantage to putting a separate id in with the <ul>? Or is it just adding more code than necessary?


« Last Edit: Jul 27, 2008, 11:11:04 PM by Nikolas »
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6487
39754 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 27, 2008, 09:59:13 PM »

you can use an ID only once, if you have multiple list inside the container "navcont" it's better to use a "natural" list element.

you can style the list also like this:

#navcont ul { ...}


Last blog : Just a better Internet portal provided by Google
Nikolas' Servant Child
*
Posts: 30
184 credits
Members referred : 0


« Reply #2 on: Jul 28, 2008, 12:28:59 PM »

If you have a single navigation list, either style works. However I would prefer to put an ID on the UL itself, since this allows you to put other ULs in the same DIV that aren't part of the navigation list without them being accidentally styled as a nav list.

Alternatively, you can style the list by using a class rather than an ID. This allows you to have multiple nav lists on the same page, or use the stylesheet on multiple pages without requiring the same ID for the nav list on every page.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7874
Tags : navlist Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design  >  CSS (Moderator: Meth0d)
Topic: To <ul ="navlist"> or not to <ul ="navlist">
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 05, 2008, 03:54:49 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 38.000
Total Topics: 7.685
Total Members: 4.470
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: srinivasarao

30 Guests, 3 Users online :

9 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.