Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Horizontal CSS Navigation
Old 10-28-2007, 06:26 PM Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
I have got two Images for each link: 1 active, 1 hover
i need them to go horizontally across the center of the page
http://whytey.ihostq.com/impulse2/


Code:
 
<div id="nav2">
<ul>
<a class="home" href="#">&nbsp;</a>
<a class="forum" href="#">&nbsp;</a>
<a class="residents" href="#">&nbsp;</a>
<a class="pictures" href="#">&nbsp;</a>
<a class="volumes" href="#">&nbsp;</a>
<a class="events" href="#">&nbsp;</a>
</ul>
</div>
Code:
#nav2 li ul a {
  display: block;
} 

a.volumes {
display: block;
width: 85px;
height: 32px;
background: url("http://www.webmaster-talk.com/images/volumes1.gif") 0 0 no-repeat;
}

a:hover.volumes {
display: block;
width: 85px;
height: 32px;
background: url("http://www.webmaster-talk.com/images/volumes2.gif") 0 0 no-repeat;
 }

etc....

Last edited by Whytey; 10-28-2007 at 06:27 PM..
Whytey is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-28-2007, 06:32 PM Re: Horizontal CSS Navigation
blue-dreamer's Avatar
King Spam Talker

Posts: 1,222
Location: Middle England
Trades: 0
a:hover.volumes is incorrect try a.volumes:hover
blue-dreamer is offline
Reply With Quote
View Public Profile
 
Old 10-28-2007, 06:45 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
Seems to hover just the same as before
Whytey is offline
Reply With Quote
View Public Profile
 
Old 10-29-2007, 02:02 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
Now i just need to place those images in center of navbg for rollovers
Whytey is offline
Reply With Quote
View Public Profile
 
Old 10-29-2007, 02:55 PM Re: Horizontal CSS Navigation
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Get rid of that horrid <center> tag and use CSS to center your site.

If you want the li items in #nav2 to be horizontal, you have to add display:inline to the li.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-29-2007, 07:28 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
I think that <center> tag is for the ads generated by google cause of the free host

I'll have a go at creating the nav again with inline display is there anything else i should add to #nav while i alter it?

Last edited by Whytey; 10-29-2007 at 07:30 PM..
Whytey is offline
Reply With Quote
View Public Profile
 
Old 10-31-2007, 02:22 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
images arnt showing now
Whytey is offline
Reply With Quote
View Public Profile
 
Old 10-31-2007, 02:31 PM Re: Horizontal CSS Navigation
Defies a Status

Posts: 3,420
Trades: 0
Try floating the li's left instead of displaying inline as demonstrated below:

Quote:
li {float: left;}
As I said, remove the display inline part - I always use float:left on the nav bar li's as that works for me. Try it out and see if it works
CSS4Life is offline
Reply With Quote
View Public Profile
 
Old 10-31-2007, 02:56 PM Re: Horizontal CSS Navigation
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You tempt some IE bugs with the floats, but yes, it's one other possibility.
The display inline should work fine.

The display:inline didn't work because your code is incorrect. You have this:
Quote:
<ul>
<a class="home" href="#">&nbsp;</a>
<a class="forum" href="#">&nbsp;</a>
<a class="residents" href="#">&nbsp;</a>
<a class="pictures" href="#">&nbsp;</a>
<a class="volumes" href="#">&nbsp;</a>
<a class="events" href="#">&nbsp;</a>
You have to enclose those links inside <li></li> tags in order for it to be a
proper list.
</ul>
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-31-2007, 07:46 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
Oops i didnt post the new code
Code:
<div id="nav2">
<ul>
<li class="home"> <a href="#">&nbsp;</a></li>
<li class="forum"><a href="#">&nbsp;</a></li>
<li class="residents"><a href="#">&nbsp;</a></li>
<li class="pictures"><a href="#">&nbsp;</a></li>
<li class="volumes"><a href="#">&nbsp;</a></li>
<li class="events"><a href="#">&nbsp;</a></li>
</ul>
</div>
Code:
#nav2 li ul{
display: inline;
list-style: none;
} 

#nav2 li.volumes a:active {
width: 85px;
height: 32px;
background: url("http://www.webmaster-talk.com/images/volumes1.gif");
}

#nav2 li.volumes a:hover {
width: 85px;
height: 32px;
background: url("http://www.webmaster-talk.com/images/volumes2.gif");
 }

Last edited by Whytey; 10-31-2007 at 07:56 PM..
Whytey is offline
Reply With Quote
View Public Profile
 
Old 10-31-2007, 08:17 PM Re: Horizontal CSS Navigation
SeventotheSeven's Avatar
Novice Talker

Posts: 12
Name: Jeff
Trades: 0
Your css selector is incorrect, and you're missing the float: left; . Try changing:

Quote:
#nav2 li ul a {
border-bottom:1px solid #3399FF;
border-right:1px solid #3399FF;
border-top:1px solid #3399FF;
display:block;
padding:0.25em 1em;
text-decoration:none;
}
to

Code:
#nav2 ul a {

float: left;
border-bottom:1px solid #3399FF;
border-right:1px solid #3399FF;
border-top:1px solid #3399FF;
display:block;
padding:0.25em 1em;
text-decoration:none;
}
You'll also probably want to change the right padding to right margin
SeventotheSeven is offline
Reply With Quote
View Public Profile
 
Old 11-01-2007, 02:46 PM Re: Horizontal CSS Navigation
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
The float: left is not really necessary.
What you DO need is a height on the list items or padding at the top and bottom of the <a> to equal the height of the graphic.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-05-2007, 05:33 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
I have only just got round to this site again
anyway here is what i have so far - http://whytey.ihostq.com/impulse2/
the active link doesnt appear to be changing when hovered over, instead
it goes below it when you right click on the img bg, also i set height for the images
in list item but there still not the right size

Last edited by Whytey; 11-05-2007 at 05:40 PM..
Whytey is offline
Reply With Quote
View Public Profile
 
Old 11-05-2007, 09:08 PM Re: Horizontal CSS Navigation
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Ok, if you're going to use pseudo classes, you have to define them in a particular order: Link, Visited, Hover, Active - think LoVeHAte.

You have a class on each li to change the image. I would strongly suggest you make your bg image generic, then use actual text on the link. This eliminates the need to have to add extra classes for the menu, and it makes your menu more accessible. It should also simplify it considerably.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-06-2007, 01:31 PM Re: Horizontal CSS Navigation
Whytey's Avatar
Experienced Talker

Posts: 32
Location: United Kingdom
Trades: 0
I said to the person who designed the nav that it would be alot eaiser using text on the bgimage becuase you could then style it up and would save time but didnt end up doing that.

Could i not just do something like this?
http://whytey.ihostq.com/css.html and change the postion from active to hover in the css
Whytey is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Horizontal CSS Navigation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.31857 seconds with 12 queries