Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > All Around Tutorials
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 09-02-2004, 04:08 PM
  #1
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 8,387
iTrader: (0)
coothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud of
~ css rollover - another example ~

Hi there folks,

here is another example of the 'css' rollover that you might find interesting.
It uses a single image like this...


...instead of two.
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english"> 
<meta http-equiv="Content-Style-Type" content="text/css">

<title>CSS single image rollover</title>

<style type="text/css">
body { 
     background:#999;
 }
#image {
     display:block;
     width:100px;
     height:99px;
     border:inset 8px #888;
     margin:200px auto 0;
     background:url(http://www.coothead.co.uk/images/single_image_rollover.gif) 0 0 no-repeat;
     text-align:center;
     font-family:arial,sans-serif;
     font-size:1.1em;
     color:#fa3999;
     line-height:99px;
     text-decoration:none;    
  }
#image:hover  {
     background-position:-100px 0; 
     color:#39fa99;
  }
</style>

</head>
<body>

<div>
<a id="image" href="#">css rollover</a>
</div>

</body>
</html>
__________________

Last edited by coothead : 09-17-2009 at 05:09 AM. Reason: typing errors, of course!!
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-03-2004, 06:44 AM
  #2
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 4,162
iTrader: (0)
RysChwith will become famous soon enough
So it just shifts the image to the side, with only the one color showing through the container at a time? Interesting.

Rys
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-03-2004, 08:30 AM
  #3
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 8,387
iTrader: (0)
coothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud of
Hi there RysChwith,
Quote:
So it just shifts the image to the side, with only the one color showing through the container at a time?
Yes that is correct, so there is no need for preloading and I believe that the rollover
will also be faster than when using two separate images.

Of course, it may take a little while longer to make the single image in an editor
I spent about an hour working on the animated gif
__________________
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-19-2004, 03:03 PM
  #4
coothead
~ bald headed old fart ~
 
coothead's Avatar
 
Join Date: Aug 2003
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 8,387
iTrader: (0)
coothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud ofcoothead has much to be proud of
Hi there folks,

when I first did this thread I forgot to show a working example,
although a 'copy & paste' would have worked.

So here is the link...
__________________

Last edited by coothead : 09-17-2009 at 05:15 AM.
coothead is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-20-2004, 11:54 AM
  #5
AaronCampbell
Resident PHP OOP Master
 
AaronCampbell's Avatar
 
Join Date: Aug 2003
Location: Chained to my computer
Posts: 1,619
iTrader: (0)
AaronCampbell is on a distinguished road
Nice on Coothead...I'm gonna put this in my "to use on future sites" folder
AaronCampbell is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-14-2006, 08:40 PM
  #6
shinta_himura
Soldier (Level 11)
 
shinta_himura's Avatar
 
Join Date: Dec 2005
Posts: 106
iTrader: (0)
shinta_himura is an unknown quantity at this point
Wow cool! Good job!!! This is a revolutionary invention someone should give you money for this
shinta_himura is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 05-26-2006, 07:35 AM
  #7
welshsteve
Cue Master
 
welshsteve's Avatar
 
Join Date: Oct 2005
Location: Leamington Spa, UK
Posts: 2,444
iTrader: (0)
welshsteve is on a distinguished road
yeah good job. I'm working ona site at the moment where I want a normal image, a hover image, and an image to display when the particular page the link is for is displayed. I'm assuming I could apply the same theory for any number of images?
welshsteve is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 06-06-2006, 02:59 PM
  #8
karinne
\m/\m/
 
Join Date: Dec 2002
Location: QC, Canada
Posts: 4,297
iTrader: (0)
karinne is on a distinguished road
Yes steve you can, just add another image in that one image

Kinda like here on Fast Rollovers Without Preload

__________________
[a web design portfolio - AVAILABLE for work | web design | Re-coding | PSD-to-HTML]
I'm also on: del.icio.us | flickr | virb | facebook | twitter
karinne is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-27-2007, 01:01 PM
  #9
imagn
 
Join Date: Jul 2007
Location: Los Angeles
Posts: 1
iTrader: (0)
imagn is an unknown quantity at this point
Using a simple JavaScript to change class names might be a better way to go.
imagn is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 11:08 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.