473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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;
}
Jul 20 '05 #1
4 6362
"Applebrown" <ap********@gamebanshee.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?
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...etal/index.htm
Here's my simple centered navbar with extraneous (alt) coding removed:
alt is _never_ extraneous. ;-)
<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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
"Steve Pugh" <st***@pugh.net> wrote in message
news:jj********************************@4ax.com...
"Applebrown" <ap********@gamebanshee.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 :)
<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 samesize "_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?

Jul 20 '05 #3

"Applebrown" <ap********@gamebanshee.takethis.andthisout.com> wrote in
message news:oU5vc.643847$Ig.21454@pd7tw2no...
"Steve Pugh" <st***@pugh.net> wrote in message
news:jj********************************@4ax.com...
"Applebrown" <ap********@gamebanshee.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.
<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 samesize "_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?

Jul 20 '05 #4
"Applebrown" <ap********@gamebanshee.takethis.andthisout.com> wrote:
"Steve Pugh" <st***@pugh.net> wrote in message
news:jj********************************@4ax.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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave | last post by:
Hi all, I was trying to make an image submit button with a rollover and discovered to my suprise that there is no way to access a form element of the "image" type. I tried specifying it by name...
8
by: Nathan Sokalski | last post by:
I have several System.Web.UI.WebControls.HyperLink Controls which I want to display as rollover images. I know how to make these manually using the <a> and <img> tags or the <a> tag and a...
2
by: sachaburnett | last post by:
Hi everyone! I'm new to Javascript and am finding so much useful information on this group, so thanks to you all! I have a question about preloading images for onmouseover/out effects and...
7
by: simchajoy2000 | last post by:
Hi, I am just a javascript beginner so maybe this is a simple problem but I am trying to do some rollovers on images in a separate <div>. Here is the relevent piece of my code: <html>...
1
by: atombee | last post by:
Hi- this is the project that will not end! (sure you've all been there). I had originally purchased a php/css nav bar for the client, but it was buggy as hell, so I decided to do in css, in which I...
3
by: sevenalive | last post by:
Hi-- I am very new at this and trying to teach myself, and I have run into a roadblock that I can't figure out no matter how many times I Google it......my navbar is a vertical column of images,...
1
by: nicky77 | last post by:
Hi, I've created a nav bar using a background image for rollover effects. Everything works as I had hoped, however, for some reason it seems that an area of whitespace (the same size of the...
2
by: Casimir | last post by:
I am looking into making pure CSS image rollovers. Do you have any clever (and robust) CSS rollover-tricks? Or links to such "in the wild"? I have figured out two methods for this, but have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.