![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All I have 4 buttons as you can see in the code - i also have a rollover effect by moving the background image down, again as the code shows. The button image actually consists of three images - 1 for an un-active state, 1 for rollover effect, and i also have one for when the page is active. I have 4 pages on the site, how do i make each button in its active state when you are on each section of the site? So when i am on the home page, the home button is in its 'active state' and then when i click to videos for example, the home button goes to its un-active state and the video button is now in the active state? Hope all that makes sense. Any help on this will be very much appreciated!!! Thanks JP ul#nav li a { display: block; height: 83px; text-indent: -9999px; float: left } ul#nav li.home a { width: 262px; background:url(Images/nav_home.jpg) bottom center no-repeat; } ul#nav li.videos a { width: 200px; background: url(Images/nav_video.jpg) bottom center no-repeat; } ul#nav li.downloads a { width: 200px; background:url(Images/nav_downloads.jpg) bottom center no-repeat; } ul#nav li.contact a { width: 338px; background:url(Images/nav_contact.jpg) bottom center no-repeat; } ul#nav li a:hover { background-position: center center; } |
#3
| |||
| |||
|
|
You would add that particular state as css on each individual page. I would also go ahead and assign the class to each element in the list, and just call them on the necessary pages. On the home page, add to the page's <head>: a#button1 { background-image: url(Images/nav_bkgrd_active.jpg); } And in your navigational list (have you thought about using an include file for your nav menu?) make sure you add class="button1" for the home link. You'll need to remember to add button2, button3, button4, etc., for your other links and then add to each page, accordingly. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
So, just to get this right - i give each button a class and then adjust that class attributes for when the page is active? One thing i don't understand is that you mention to add CSS under the <head> ? That doesn't make sense to me, adding CSS into the <head> element of a HTML page? Or am i reading this wrong? Sorry. . . Whats an 'include file'? All the pages at the moment are running from the same CSS page - can i just add pages of CSS and adjust them accordingly? So i will have a different CSS coding for each page? Thanks JP |
#6
| |||
| |||
|
|
You would add that particular state as css on each individual page. I would also go ahead and assign the class to each element in the list, and just call them on the necessary pages. On the home page, add to the page's <head>: a#button1 { background-image: url(Images/nav_bkgrd_active.jpg); } And in your navigational list (have you thought about using an include file for your nav menu?) make sure you add class="button1" for the home link. You'll need to remember to add button2, button3, button4, etc., for your other links and then add to each page, accordingly. -- Virginia Carter Carolina Web Creations ====================== www.carolinawebcreations.biz thewakeplace.com wrote: Hi All I have 4 buttons as you can see in the code - i also have a rollover effect by moving the background image down, again as the code shows. The button image actually consists of three images - 1 for an un-active state, 1 for rollover effect, and i also have one for when the page is active. I have 4 pages on the site, how do i make each button in its active state when you are on each section of the site? So when i am on the home page, the home button is in its 'active state' and then when i click to videos for example, the home button goes to its un-active state and the video button is now in the active state? Hope all that makes sense. Any help on this will be very much appreciated!!! Thanks JP ul#nav li a { display: block; height: 83px; text-indent: -9999px; float: left } ul#nav li.home a { width: 262px; background:url(Images/nav_home.jpg) bottom center no-repeat; } ul#nav li.videos a { width: 200px; background: url(Images/nav_video.jpg) bottom center no-repeat; } ul#nav li.downloads a { width: 200px; background:url(Images/nav_downloads.jpg) bottom center no-repeat; } ul#nav li.contact a { width: 338px; background:url(Images/nav_contact.jpg) bottom center no-repeat; } ul#nav li a:hover { background-position: center center; } |
#7
| |||
| |||
|
|
"...assign the class to each element in the list...." That's an ID not a class.... 8) |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
So the CSS is like this? As long as i have tagged my body pages with the 'home' then 'video' etc??? And that CSS is all in the same CSS document? ul#nav li.home a { width: 262px; background:url(Images/nav_home.jpg) bottom center no-repeat; } ul#nav li.videos a { width: 200px; background: url(Images/nav_video.jpg) bottom center no-repeat; } ul#nav li.downloads a { width: 200px; background:url(Images/nav_downloads.jpg) bottom center no-repeat; } ul#nav li.contact a { width: 338px; background:url(Images/nav_contact.jpg) bottom center no-repeat; } ul#nav li a:hover { background-position: center center; } body#home ul#nav li.home a { background-position: top center; } body#video ul#nav li.video a { background-position: top center; } |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |