Advanced Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignAdvanced Web Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 21st, 2005, 08:12 PM
mhykhh mhykhh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 1 mhykhh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 46 sec
Reputation Power: 0
CSS Navigation Bar Help

Hi,

I'm quite new to table-less designing and I'm having a bit of a problem here. Here's the scenario:

The current layout uses tables and I'm trying to convert it to use CSS only. The main div has a width of 100% to stretch/reduce its size depending on the browsers display size. I have a top-menu where I want links to have dynamic left and right padding values so it will adjust itself depending on the screen resolution/browser display size.

Using tables, this is not a problem by using width on the TD with a percentage value. But I can't seem to make it work with a parent DIV and SPAN for all the links.

Sample HTML:
Quote:
<div id="top-menu">
<span><a href="">Home</a></span>
<span><a href="">Link 2</a></span>
<span><a href="">Link 3</a></span>
<span><a href="">Link 3</a></span>
<span><a href="">Link 4</a></span>
<span><a href="">Link 5</a></span>
<span><a href="">Link 6</a></span>
</div>


and here's the CSS:
Quote:
#top-menu
{
background-color: #C5C8B4;
padding: 2px;
border-bottom: 1px solid #000;
}

#top-menu span
{
border-right: 1px solid #000;
padding-left: 2%;
padding-right: 2%;
}


I just want the links to spread and take the whole width of the DIV with equal spaces between each other and not wrap and create a second line.

Thanks in advance for any help.

Reply With Quote
  #2  
Old July 25th, 2006, 12:32 PM
firefiend firefiend is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 firefiend User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 50 sec
Reputation Power: 0
hello hello,

the best option i think is to ditch <span> and us <ul> instead.

If you think about it, a nav bar is really an unordered list so why not treat it as such in your code.

then, using CSS you can easily position it as you like.

check out A List Apart for great articles regarding this.




hope this helps


Reply With Quote
  #4  
Old July 26th, 2006, 08:37 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Here's another great resource: Listamatic: one list, many options

Myself, I used to use Dan Cederholm's mini tabs as a base whenever I would do it.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #5  
Old August 11th, 2006, 02:07 AM
eihd eihd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 3 eihd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 56 sec
Reputation Power: 0
A CSS resource site

Not very familiar with CSS, I used to use this app to make the width of my menu stretch dynamicly.

BTW, A List Apart is great

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignAdvanced Web Development > CSS Navigation Bar Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT