HighDots Forums  

Navbar Image Rollover using CSS

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Navbar Image Rollover using CSS in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Applebrown
 
Posts: n/a

Default Navbar Image Rollover using CSS - 06-01-2004 , 03:13 PM






Greetings,

I'm attempting to make a simple horizontal navbar with three image links,
and with those images replaced on hover and active... and I'm not sure of
the proper CSS to do this, though I've tried unsuccessfully.

This is the site: www.sunbadgeco.com/sunmetal/index.htm

Here's my simple centered navbar with extraneous (alt) coding removed:
<div id="navmain">

<a href="artists.htm"><img src="images/artists_inactive.jpg" border="0"
width="148" height="35"></a>
<img src="images/spacergraphic.gif" width="55" height="35">
<a href="contact.htm"><img src="images/contact_inactive.jpg" border="0"
width="163" height="35"></a>
<img src="images/spacergraphic.gif" width="55" height="35">
<a href="about.htm"><img src="images/about_inactive.jpg" border="0"
width="90" height="35"></a>

</div>

I'd like each link image named "_inactive.jpg" to be swapped with the same
size "_active.jpg" when hovered over. The lights behind the text are
supposed to go from dim to bright using this method. Any help would be
greatly appreciated.

My navmain CSS follows:
#navmain {
display: block;
margin-left: auto;
margin-right: auto;
padding: 0;
text-align: center;
}



Reply With Quote
  #2  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Navbar Image Rollover using CSS - 06-01-2004 , 04:12 PM






"Applebrown" <applebrown (AT) gamebanshee (DOT) takethis.andthisout.com> wrote:

Quote:
I'm attempting to make a simple horizontal navbar with three image links,
and with those images replaced on hover and active...
and on focus as well?

Quote:
and I'm not sure of
the proper CSS to do this, though I've tried unsuccessfully.
CSS (as supported by current browsers and especially IE) can only set
background images.

Quote:
This is the site: www.sunbadgeco.com/sunmetal/index.htm
Oh dear:
http://validator.w3.org/check?uri=ht...etal/index.htm

Quote:
Here's my simple centered navbar with extraneous (alt) coding removed:
alt is _never_ extraneous. ;-)

Quote:
div id="navmain"
a href="artists.htm"><img src="images/artists_inactive.jpg" border="0"
width="148" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="contact.htm"><img src="images/contact_inactive.jpg" border="0"
width="163" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="about.htm"><img src="images/about_inactive.jpg" border="0"
width="90" height="35"></a
/div

I'd like each link image named "_inactive.jpg" to be swapped with the same
size "_active.jpg" when hovered over. The lights behind the text are
supposed to go from dim to bright using this method. Any help would be
greatly appreciated.

My navmain CSS follows:
#navmain {
display: block;
margin-left: auto;
margin-right: auto;
padding: 0;
text-align: center;
}
Either make the images background images and change them via CSS, or
change the foreground images with JavaScript.

Steve


--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
  #3  
Old   
Applebrown
 
Posts: n/a

Default Re: Navbar Image Rollover using CSS - 06-01-2004 , 04:44 PM



"Steve Pugh" <steve (AT) pugh (DOT) net> wrote

Quote:
"Applebrown" <applebrown (AT) gamebanshee (DOT) takethis.andthisout.com> wrote:

I'm attempting to make a simple horizontal navbar with three image links,
and with those images replaced on hover and active...

and on focus as well?
er... hmm? Yes, I have lots to learn.

Quote:
and I'm not sure of
the proper CSS to do this, though I've tried unsuccessfully.

CSS (as supported by current browsers and especially IE) can only set
background images.

This is the site: www.sunbadgeco.com/sunmetal/index.htm

Oh dear:

http://validator.w3.org/check?uri=ht...nmetal/index.h
tm
Quote:
Here's my simple centered navbar with extraneous (alt) coding removed:
It's my first attempt at completely XHTML and the site's not live yet. Not
to mention it's my first attempt at a completely CSS driven site. It will be
fixed

Quote:
div id="navmain"
a href="artists.htm"><img src="images/artists_inactive.jpg" border="0"
width="148" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="contact.htm"><img src="images/contact_inactive.jpg" border="0"
width="163" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="about.htm"><img src="images/about_inactive.jpg" border="0"
width="90" height="35"></a
/div

I'd like each link image named "_inactive.jpg" to be swapped with the
same
size "_active.jpg" when hovered over. The lights behind the text are
supposed to go from dim to bright using this method. Any help would be
greatly appreciated.

My navmain CSS follows:
#navmain {
display: block;
margin-left: auto;
margin-right: auto;
padding: 0;
text-align: center;
}

Either make the images background images and change them via CSS, or
change the foreground images with JavaScript.
Sounds like good advice. Can you give a brief example using only CSS?





Reply With Quote
  #4  
Old   
Applebrown
 
Posts: n/a

Default Re: Navbar Image Rollover using CSS - 06-01-2004 , 04:59 PM




"Applebrown" <applebrown (AT) gamebanshee (DOT) takethis.andthisout.com> wrote in
message newsU5vc.643847$Ig.21454 (AT) pd7tw2no (DOT) ..
Quote:
"Steve Pugh" <steve (AT) pugh (DOT) net> wrote in message
news:jjopb0pt43n42blmb9qbpbfk74t31h4nhm (AT) 4ax (DOT) com...
"Applebrown" <applebrown (AT) gamebanshee (DOT) takethis.andthisout.com> wrote:

I'm attempting to make a simple horizontal navbar with three image
links,
and with those images replaced on hover and active...

and on focus as well?

er... hmm? Yes, I have lots to learn.

and I'm not sure of
the proper CSS to do this, though I've tried unsuccessfully.

CSS (as supported by current browsers and especially IE) can only set
background images.

This is the site: www.sunbadgeco.com/sunmetal/index.htm

Oh dear:


http://validator.w3.org/check?uri=ht...nmetal/index.h
tm

Here's my simple centered navbar with extraneous (alt) coding removed:

It's my first attempt at completely XHTML and the site's not live yet. Not
to mention it's my first attempt at a completely CSS driven site. It will
be
fixed
All fixed.

Quote:
div id="navmain"
a href="artists.htm"><img src="images/artists_inactive.jpg" border="0"
width="148" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="contact.htm"><img src="images/contact_inactive.jpg" border="0"
width="163" height="35"></a
img src="images/spacergraphic.gif" width="55" height="35"
a href="about.htm"><img src="images/about_inactive.jpg" border="0"
width="90" height="35"></a
/div

I'd like each link image named "_inactive.jpg" to be swapped with the
same
size "_active.jpg" when hovered over. The lights behind the text are
supposed to go from dim to bright using this method. Any help would be
greatly appreciated.

My navmain CSS follows:
#navmain {
display: block;
margin-left: auto;
margin-right: auto;
padding: 0;
text-align: center;
}

Either make the images background images and change them via CSS, or
change the foreground images with JavaScript.

Sounds like good advice. Can you give a brief example using only CSS?






Reply With Quote
  #5  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Navbar Image Rollover using CSS - 06-01-2004 , 05:43 PM



"Applebrown" <applebrown (AT) gamebanshee (DOT) takethis.andthisout.com> wrote:
Quote:
"Steve Pugh" <steve (AT) pugh (DOT) net> wrote in message
news:jjopb0pt43n42blmb9qbpbfk74t31h4nhm (AT) 4ax (DOT) com...

Either make the images background images and change them via CSS, or
change the foreground images with JavaScript.

Sounds like good advice. Can you give a brief example using only CSS?
a {display: block; width: 100px; height: 20px;}
a:link {background-image: url(link.gif);}
a:hover {background-image: url(hover.gif);}
a span {display: none;}

<a href="foo.html"><span>Link Text</span></a>

Problem is that when CSS is on but images are off that nothing at all
is displayed. If you can leave the text visible and just use the
changing background for decoration then that's okay. Otherwise
JavaScript is less harmful.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.