Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 11:47 PM
Applebrown
Guest
 
Posts: n/a
Default Navbar Image Rollover using CSS

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;
}


  #2  
Old July 20th, 2005, 11:47 PM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Navbar Image Rollover using CSS

"Applebrown" <applebrown@gamebanshee.takethis.andthisout.com> wrote:
[color=blue]
>I'm attempting to make a simple horizontal navbar with three image links,
>and with those images replaced on hover and active...[/color]

and on focus as well?
[color=blue]
>and I'm not sure of
>the proper CSS to do this, though I've tried unsuccessfully.[/color]

CSS (as supported by current browsers and especially IE) can only set
background images.
[color=blue]
>This is the site: www.sunbadgeco.com/sunmetal/index.htm[/color]

Oh dear:
http://validator.w3.org/check?uri=ht...etal/index.htm
[color=blue]
>Here's my simple centered navbar with extraneous (alt) coding removed:[/color]

alt is _never_ extraneous. ;-)
[color=blue]
> <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;
>}[/color]

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@pugh.net> <http://steve.pugh.net/>
  #3  
Old July 20th, 2005, 11:47 PM
Applebrown
Guest
 
Posts: n/a
Default Re: Navbar Image Rollover using CSS

"Steve Pugh" <steve@pugh.net> wrote in message
news:jjopb0pt43n42blmb9qbpbfk74t31h4nhm@4ax.com...[color=blue]
> "Applebrown" <applebrown@gamebanshee.takethis.andthisout.com> wrote:
>[color=green]
> >I'm attempting to make a simple horizontal navbar with three image links,
> >and with those images replaced on hover and active...[/color]
>
> and on focus as well?[/color]

er... hmm? Yes, I have lots to learn.
[color=blue][color=green]
> >and I'm not sure of
> >the proper CSS to do this, though I've tried unsuccessfully.[/color]
>
> CSS (as supported by current browsers and especially IE) can only set
> background images.
>[color=green]
> >This is the site: www.sunbadgeco.com/sunmetal/index.htm[/color]
>
> Oh dear:
>[/color]
http://validator.w3.org/check?uri=ht...nmetal/index.h
tm[color=blue]
>[color=green]
> >Here's my simple centered navbar with extraneous (alt) coding removed:[/color][/color]

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 :)
[color=blue][color=green]
> > <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[/color][/color]
same[color=blue][color=green]
> >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;
> >}[/color]
>
> Either make the images background images and change them via CSS, or
> change the foreground images with JavaScript.[/color]

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



  #4  
Old July 20th, 2005, 11:48 PM
Applebrown
Guest
 
Posts: n/a
Default Re: Navbar Image Rollover using CSS


"Applebrown" <applebrown@gamebanshee.takethis.andthisout.com> wrote in
message news:oU5vc.643847$Ig.21454@pd7tw2no...[color=blue]
> "Steve Pugh" <steve@pugh.net> wrote in message
> news:jjopb0pt43n42blmb9qbpbfk74t31h4nhm@4ax.com...[color=green]
> > "Applebrown" <applebrown@gamebanshee.takethis.andthisout.com> wrote:
> >[color=darkred]
> > >I'm attempting to make a simple horizontal navbar with three image[/color][/color][/color]
links,[color=blue][color=green][color=darkred]
> > >and with those images replaced on hover and active...[/color]
> >
> > and on focus as well?[/color]
>
> er... hmm? Yes, I have lots to learn.
>[color=green][color=darkred]
> > >and I'm not sure of
> > >the proper CSS to do this, though I've tried unsuccessfully.[/color]
> >
> > CSS (as supported by current browsers and especially IE) can only set
> > background images.
> >[color=darkred]
> > >This is the site: www.sunbadgeco.com/sunmetal/index.htm[/color]
> >
> > Oh dear:
> >[/color]
>[/color]
http://validator.w3.org/check?uri=ht...nmetal/index.h[color=blue]
> tm[color=green]
> >[color=darkred]
> > >Here's my simple centered navbar with extraneous (alt) coding removed:[/color][/color]
>
> 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[/color]
be[color=blue]
> fixed :)[/color]

All fixed.
[color=blue][color=green][color=darkred]
> > > <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[/color][/color]
> same[color=green][color=darkred]
> > >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;
> > >}[/color]
> >
> > Either make the images background images and change them via CSS, or
> > change the foreground images with JavaScript.[/color]
>
> Sounds like good advice. Can you give a brief example using only CSS?
>
>
>[/color]


  #5  
Old July 20th, 2005, 11:48 PM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Navbar Image Rollover using CSS

"Applebrown" <applebrown@gamebanshee.takethis.andthisout.com> wrote:[color=blue]
>"Steve Pugh" <steve@pugh.net> wrote in message
>news:jjopb0pt43n42blmb9qbpbfk74t31h4nhm@4ax.com.. .[color=green]
>>
>> Either make the images background images and change them via CSS, or
>> change the foreground images with JavaScript.[/color]
>
>Sounds like good advice. Can you give a brief example using only CSS?[/color]

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@pugh.net> <http://steve.pugh.net/>
 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles