<style>
img.nohover {border:0}
img.hover {border:0;display:none}
A:hover img.hover {display:inline}
A:hover img.nohover {display:none}
</style>
<A HREF="#">
<img src="b1.gif" class="nohover">
<img src="b2.gif" class="hover">
</A>
TUTORIAL: CSS image rollover - horizontal navigation A simple CSS rollover tutorial using only one image
#41
Posted 28 November 2008 - 11:38 AM
#43
Posted 13 March 2009 - 10:54 PM
I have one problem which I hope someone can help me with. I'm using this code but I have the nav bar in the center of the page. It is basically the same as the original but a different graphics, obviously. I'm trying to get the bar to extend to the side of the browser, no matter what resolution/size the user is using. I thought of using a background image that repeats but this code already uses a background image.
How can I make this happen using CSS?
#44
Posted 13 March 2009 - 11:05 PM
Thanks for the comments.
You can apply a background colour with an image e.g. { background: #ccc url(menu.jpg) no-repeat 0 0; width 100%} - you'll need to set the position/repeat properties as you have to sit image centrally, but the #ccc - part means the background colour will span 100% width whilst keeping the main navigation images centrally.
Is that what you mean? If not, post the code you have and i'll try and assist you
#45
Posted 13 March 2009 - 11:14 PM
That is the site, if you look at my code, I did it by making a background of the image. That probably isn't a good way of doing it
You can see that the extensions of the menu bar would be an image. Hope that makes sense.
Thanks for the quick reply, btw.
#47
Posted 13 March 2009 - 11:34 PM
#48
Posted 13 March 2009 - 11:40 PM
Sorry for the questions, but i've been on your website and what you are asking to happen, already seems to be working... See my screenshot attached
Green arrows indicated the 100% width of grey bar and Red arrow indicates the nav is sitting under the logo...
Am I missing something here?
eden.jpg (21.41K)
Number of downloads: 6
#49
Posted 14 March 2009 - 12:09 AM
If you look at my CSS, I'm actually using a background image in the body tag. So, the bar you see is actually part of the sites background not part of the navbar. I'm sure there must be a better way?
The problem is, in IE the background/nav bar don't match so I want to beable to position the navbar and I can't do that if it is part of the background image.
#52
Posted 07 July 2009 - 09:01 AM
Many thanks once more.
#53
Posted 07 July 2009 - 10:32 AM
#54
Posted 17 November 2009 - 07:01 AM
krakatoa, on 28 November 2008 - 11:38 AM, said:
<style>
img.nohover {border:0}
img.hover {border:0;display:none}
A:hover img.hover {display:inline}
A:hover img.nohover {display:none}
</style>
<A HREF="#">
<img src="b1.gif" class="nohover">
<img src="b2.gif" class="hover">
</A>
#55
Posted 17 November 2009 - 07:34 AM
Thanks,
L
#56
Posted 18 March 2010 - 02:51 PM
Well done on the tutorial!
This was just what i was looking for and i will be trying it out, soon.
Thanks alot!
#57
Posted 30 March 2010 - 11:55 PM
#58
Posted 15 April 2010 - 10:48 AM
Not sure if you can help but after adding this navigation menu to my test website all appears fine except in internet explorer 7. In ie7 the menu is pushed to the right and is hidden until you rollover the menu when the hover image shows. Can anyone tell me what I am missing please? Site is http://www.norkey.com/pov/test and css is located here http://norkey.com/po.../css/layout.css
I'm a beginner to css so not sure what I've done wrong.
Thanks
Kelly
#59
Posted 17 June 2011 - 04:22 PM
Try as I might however, I cannot get the 'hover' to change image position. It stays on the top half of the image.
Basically followed your code but added a 5th button and changed some names around.
Any thoughts?
TIA,
Len
#60
Posted 17 June 2011 - 06:33 PM
This seems more of like a poor hack when you don't know how to do it correctly.
#61
Posted 06 December 2011 - 03:44 AM
Thanks for the tutorial, it's very useful. my question is about nav buttons with different widths- I saw that it was mentioned but I'm a beginner in CSS and I would love a visual explanation so I can learn. i'm using 6 buttons, the first three are around the same width as the default in the tutorial. the next two are almost twice as big, and i'm struggling.
any help would be appreciated. thanks. i've uploaded my test page, as i don't want to live update my portfolio site until i know it's perfect.
http://nausetee.net/...r-tutorial.html
This post has been edited by nauset: 06 December 2011 - 03:53 AM
Help



















