homepage Welcome to WebmasterWorld Guest from 54.205.122.62
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Pure CSS Rollover
Swapping backgrounds on <a>: what about this solution?
DrOliver

10+ Year Member



 
Msg#: 269 posted 11:43 am on Aug 7, 2002 (gmt 0)

I just came up with this idea:

CSS:
a{width:100px;display:block;text-decoration:none;}
a:link{background:#000 url(off.gif);color:transparent;}
a:hover{background:#000 url(on.gif);color:transparent;}

html:
<p><a href="#" title="click here to find out how to reach us">&nbsp;</a></p>

Assume the link image is 100 px wide. It works on IE and Mozilla. It has a title attribut. Even users of text only browser should be able to find out what that link does, although it's a &nbsp;.

One could even have a a:visited with a different background-image to make clear that link has already been followed. Same goes for a:active.

I don't like my own idea too much, but... what do you think?

 

Nick_W

WebmasterWorld Senior Member nick_w us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 269 posted 11:48 am on Aug 7, 2002 (gmt 0)

Looks alright. There are a few tutorials dotted around on this subject, though not being gfx gifted I tend to go with plain text rollovers.

Couple of points without testing:


  • Text browsers/screen readers don't 'click'. Better to use 'follow this link'
  • You could make it slightly more robust by enclosing the a's in a 100px wide div.

Other than that, looks like a nice job and that you're enjoying the whole css trip ;)

Nick

moonbiter

10+ Year Member



 
Msg#: 269 posted 2:03 pm on Aug 7, 2002 (gmt 0)

Another really nice effect with CSS: you can nest images or blocks of text and show/hide them on mouseover. Eric Meyer demonstrates the effect [meyerweb.com], which I think is pretty cool.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved