The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Create CSS Image Rollovers, Setup image Navigation using CSS rollover
atshr
post Sep 30 2014, 01:01 AM
Post #1





Group: Members
Posts: 1
Joined: 30-September 14
Member No.: 21,609



Hi Everyone,

Would like to know how to setup image navigation using CSS rollovers.

Here is my HTML code:

<div>
<nav role="navigation">
<ul>
<li class="home"><a href="index.html"><img src="images/home.jpg" alt="logo" width="113" height="43" /></a></li>
<li class="myths"><a href="myths.html"><img src="images/myths.jpg" alt="logo" width="113" height="43" /></a></li>
<li class="truths"><a href="truths.html"><img src="images/truths.jpg" alt="logo" width="113" height="43" /></a></li>
<li class="video"><a href="video.html"><img src="images/video.jpg" alt="logo" width="113" height="43" /></a></li>
<li class="contact_us"><a href="contact_us.html"><img src="images/contact_us.jpg" alt="logo" width="113" height="43" /></a></li>
</ul>
</nav>
</div>


Here is my CSS code:

ul {
list-style-type: none;
}

li {
float: left;
position: relative;
right: -368px;
bottom: 97px;
}

a {
display: block;
width: 110px;
padding-left: 1px;
padding-right: 5px;
}


*/ The following information is where I'm having trouble trying to load the image buttons and there are two. The two image files I have are loaded in a folder title images and each image has a unique filename. The second image I also want it to be an active link */


li.myths {
background: url(images/myths-black.jpg);
}


li.myths a:hover img{
visibility: hidden;
}


Any timely advice to resolve this situation would be greatly appreciated.


atshr
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Sep 30 2014, 03:53 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



Use the images as background-image. See http://css.maxdesign.com.au/listamatic/horizontal29.htm .

Or use a CSS sprite. See
http://css-tricks.com/css-sprites/
http://css-tricks.com/snippets/css/basic-l...-as-css-sprite/
http://www.smashingmagazine.com/2009/04/27...-and-tutorials/
http://wellstyled.com/css-nopreload-rollovers.html

And for the "active" (or actually "current") link, have a look here: http://www.impressivewebs.com/current-page-link-styles/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 30 2014, 07:40 AM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,731
Joined: 9-August 06
Member No.: 6



You could use inline images but then you need both images in the HTML source and then hide one or the other with display: none and switch on :hover. So this isn't a good option because it would look odd without CSS.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 11:24 AM