473,780 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.h tm"><img src="images/artists_inactiv e.jpg" border="0"
width="148" height="35"></a>
<img src="images/spacergraphic.g if" width="55" height="35">
<a href="contact.h tm"><img src="images/contact_inactiv e.jpg" border="0"
width="163" height="35"></a>
<img src="images/spacergraphic.g if" 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.jp g" 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 6372
"Applebrown " <ap********@gam ebanshee.taketh is.andthisout.c om> 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.h tm"><img src="images/artists_inactiv e.jpg" border="0"
width="148" height="35"></a>
<img src="images/spacergraphic.g if" width="55" height="35">
<a href="contact.h tm"><img src="images/contact_inactiv e.jpg" border="0"
width="163" height="35"></a>
<img src="images/spacergraphic.g if" 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.jp g" 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.c om...
"Applebrown " <ap********@gam ebanshee.taketh is.andthisout.c om> 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.h tm"><img src="images/artists_inactiv e.jpg" border="0"
width="148" height="35"></a>
<img src="images/spacergraphic.g if" width="55" height="35">
<a href="contact.h tm"><img src="images/contact_inactiv e.jpg" border="0"
width="163" height="35"></a>
<img src="images/spacergraphic.g if" 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.jp g" 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********@gam ebanshee.taketh is.andthisout.c om> wrote in
message news:oU5vc.6438 47$Ig.21454@pd7 tw2no...
"Steve Pugh" <st***@pugh.net > wrote in message
news:jj******** *************** *********@4ax.c om...
"Applebrown " <ap********@gam ebanshee.taketh is.andthisout.c om> 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.h tm"><img src="images/artists_inactiv e.jpg" border="0"
width="148" height="35"></a>
<img src="images/spacergraphic.g if" width="55" height="35">
<a href="contact.h tm"><img src="images/contact_inactiv e.jpg" border="0"
width="163" height="35"></a>
<img src="images/spacergraphic.g if" 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.jp g" 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********@gam ebanshee.taketh is.andthisout.c om> 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
3052
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 and also by the elements array with no luck. Even weirder, I can sandwich an image button in between other input types and then write a script diplaying the contents of the elements array and it acts as if the image button does not exist at all!...
8
3800
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 System.Web.UI.WebControls.Image Control or a HyperLink and Image Controls, but the onMouseOver and onMouseOut attributes must be in the <img> tag. If I were to use the HyperLink's ImageUrl property and add the attributes using the...
2
2985
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 found so many different ways to do it on the Net but am not sure about something. Right now I have the following code inside my <head> tag:
7
2462
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> <head> <script type="text/javascript"> if (document.images) {
1
1813
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 am still a novice, I am afraid. You can see the sample nav bar at www.tangerine-sky.com/horizontal_nav.html (I am pasting source code below) It's very simple, has the css included in the page ... works fine on a mac, okay on firefox on a PC but...
3
1651
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, and I want it to go up next to the rest of the page (which consists of a banner image, a h1 image, and some text). It insists on beginning itself below the text on the page. Here is what I've got (I'm sorry if it's confusing---it is probably a...
1
2452
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 background image) is hyperlinked underneath the nav bar. I can't see any errors in the coding below. Any ideas what may be causing this? the page is at http://www.maguiresonline.co.uk/wosis/files/nickysnav.html the html.... <body...
2
3444
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 yet to do proper testing on browser support. Method I:
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.