image
image

|


Go Back   macosx.com > Design, Media, Programming & Scripting > Design & Media

Reply
 
Thread Tools
  #1  
Old May 16th, 2005, 09:06 PM
Perseus's Avatar
Registered User
 
Join Date: Mar 2003
Location: Brooklyn, NY
Posts: 445
Thanks: 0
Thanked 0 Times in 0 Posts
Perseus is on a distinguished road
Exclamation Need a CSS nav bar tutorial

For some reason, I am unable to find a thorough and clean tutorial on how to create a CSS navigation bar. All I want is my bar to contain an "up" image and "rollover" image states, and when clicked, will link to another page.

The tutorials have seen include complex ways to manipulate links and a:link, a:hover states etc, and I just dont understand it. Can anyone help me?
__________________
PowerMac G4 | Dual 500 MHz | 640 RAM | OS 10.4.6 | CD-R/DVD-R | 64 VRAM
PowerBook 100 | 4 RAM | OS 7.2
Reply With Quote
  #2  
Old May 16th, 2005, 10:00 PM
Registered User
 
Join Date: Sep 2004
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
bigdoug is on a distinguished road
a:link {color: black; text-decoration: none;}
a:active{color:black; text-decoration: underline; }
a:visited{ color:black; text-decoration: none;}
a:hover {color:red; text-decoration:underline;}

this will make a generic rollover with an underline on the text. if you want more help write back
Reply With Quote
  #3  
Old May 17th, 2005, 12:06 AM
Perseus's Avatar
Registered User
 
Join Date: Mar 2003
Location: Brooklyn, NY
Posts: 445
Thanks: 0
Thanked 0 Times in 0 Posts
Perseus is on a distinguished road
Im asking for a navigation bar consisting of images that are buttons. There will be a normal state (one image) and the rollover state (second image). When clicked, you will be linked to another page. Thats all.
__________________
PowerMac G4 | Dual 500 MHz | 640 RAM | OS 10.4.6 | CD-R/DVD-R | 64 VRAM
PowerBook 100 | 4 RAM | OS 7.2
Reply With Quote
  #4  
Old May 17th, 2005, 12:25 AM
Pengu's Avatar
Digital Music Pimp
 
Join Date: Nov 2002
Location: Um.. Here.
Posts: 1,591
Thanks: 0
Thanked 0 Times in 0 Posts
Pengu is on a distinguished road
.buttonOne
{
backround-image: url(image.png);
}

.buttonOne:hover
{
background-image: url(imageOver.png);
}
__________________
PowerMac G5 Dual 2.0Ghz | 1Gb | 250Gb | Bluetooth | NVidia GeForce 6800 Ultra DDL 256Mb | 20" Cinema Display | MX1000 Wireless Laser Mouse | OS X 10.3.9

PowerMac G4 400Mhz | 832Mb | 40Gb + 120Gb | OS X Server 10.3.8 - Web Dev, Proxy, Mail, NAT, Firewall, Backup

Netgear Gigabit Switch | Sony Ericsson P910i Smartphone | iPod Colour 60Gb
Reply With Quote
  #5  
Old May 17th, 2005, 12:26 AM
Pengu's Avatar
Digital Music Pimp
 
Join Date: Nov 2002
Location: Um.. Here.
Posts: 1,591
Thanks: 0
Thanked 0 Times in 0 Posts
Pengu is on a distinguished road
check out this page. I've got a lot of stuff, but the buttons are in a seperate CSS file.

http://pengu.uttx.net

http://pengu.uttx.net/css/buttons.css
__________________
PowerMac G5 Dual 2.0Ghz | 1Gb | 250Gb | Bluetooth | NVidia GeForce 6800 Ultra DDL 256Mb | 20" Cinema Display | MX1000 Wireless Laser Mouse | OS X 10.3.9

PowerMac G4 400Mhz | 832Mb | 40Gb + 120Gb | OS X Server 10.3.8 - Web Dev, Proxy, Mail, NAT, Firewall, Backup

Netgear Gigabit Switch | Sony Ericsson P910i Smartphone | iPod Colour 60Gb
Reply With Quote
  #6  
Old May 17th, 2005, 12:33 AM
mdnky's Avatar
[Bobs/Prog/Design:~] mod%
 
Join Date: Jul 2001
Location: Baton Rouge, LA - USA
Posts: 2,638
Thanks: 0
Thanked 0 Times in 0 Posts
mdnky is on a distinguished road
Code:
------
HTML
------

<ul id="navlist">
     <li><a href="link.html" accesskey=" " title="Link Title Here">Link Text</a></li>
<li><a href="link.html" accesskey=" " title="Link Title Here">Link Text</a></li>
<li><a href="link.html" accesskey=" " title="Link Title Here">Link Text</a></li>
<li><a href="link.html" accesskey=" " title="Link Title Here">Link Text</a></li>
</ul>



------
CSS
------

#navlist {
     margin: 0;
     padding: 0;
     list-style: none;
     }

#navlist li a:link, #navlist li a:visited {
     display: block;
     width: 100px;
     height: 30px;
     color: #c03;
     background: transparent url("imagename-normalstate.png") no-repeat top left;
     }

#navlist li a:hover {
     color: #039;
     background: transparent url("imagename-overstate.png") no-repeat top left;
     }
That's assuming you aren't putting the text of the link in the image (a big accessibility no-no). The above code should give you a basic vertical menu. If you need to adjust spacing between buttons, then add a #navlist li rule and use margin or padding as needed.

To make it horizontal, use a #navlist li rule with display:block; float: left; or display: inline.

If you don't want to mess with all that, or at lest the back and forth, post a mock-up of how you want the image to look on the page and a copy of the normal and over states for the buttons and I'll write it up for you.


Good tutorial: http://www.listamatic.com
__________________
.
| mdnky@macosx.com | My Homepage | My Music | Restore the Pledge | MacOSX.com Widget |

• MacBook Pro Core2Duo 2.33GHz 15", 2GB DDR2 RAM, 120GB, DL Superdrive, OS X 10.5,
• Apple 23" Cinema HD Display, Apple Slim-Stainless Keyboard, Logitech Optical Scroll Mouse
• iPhone 8GB, iPod Photo 30GB, Nikon D50, Nikon L6, Epson 3490, Epson R1800, HP LaserJet 1200
• LaCie 500GB d2 Quadra, LaCie 160GB d2 FW, harman/kardon SoundSticks II, Mighty Mouse, iSight

Reply With Quote
  #7  
Old May 17th, 2005, 09:22 AM
Registered User
 
Join Date: Sep 2004
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
bigdoug is on a distinguished road
Quote:
Originally Posted by Pengu
.buttonOne
{
backround-image: url(image.png);
}

.buttonOne:hover
{
background-image: url(imageOver.png);
}
pengu...i've never seen this approach before. so do you just apply this class to a td and the images will show up in it?

bigdoug
Reply With Quote
  #8  
Old May 17th, 2005, 10:53 AM
Pengu's Avatar
Digital Music Pimp
 
Join Date: Nov 2002
Location: Um.. Here.
Posts: 1,591
Thanks: 0
Thanked 0 Times in 0 Posts
Pengu is on a distinguished road
no. if you look at the site i posted (a work in progress) you'll see they're added to each HREF, with an index-transparent PNG inside, with a class set to width: 100%; height: 100%

i forgot to add the dimensions to the classes above.
__________________
PowerMac G5 Dual 2.0Ghz | 1Gb | 250Gb | Bluetooth | NVidia GeForce 6800 Ultra DDL 256Mb | 20" Cinema Display | MX1000 Wireless Laser Mouse | OS X 10.3.9

PowerMac G4 400Mhz | 832Mb | 40Gb + 120Gb | OS X Server 10.3.8 - Web Dev, Proxy, Mail, NAT, Firewall, Backup

Netgear Gigabit Switch | Sony Ericsson P910i Smartphone | iPod Colour 60Gb
Reply With Quote
Reply

Thread Tools

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Safari - Multiple Bookmarks Bar bobw Apple News, Rumors & Discussion 0 March 16th, 2005 03:52 PM
Movable Type CSS problems (rebuild destroys CSS) michaelsanford Design & Media 0 December 20th, 2004 09:36 AM
steel-like tool bar and menu bar ? copo Mac OS X System & Mac Software 6 June 13th, 2003 10:13 AM
Window title bar moves behind OS menu bar. Brooks Mac OS X System & Mac Software 2 December 11th, 2002 09:56 PM


All times are GMT -5. The time now is 07:48 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.