NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > Webmaster Tutorials
Reload this Page CSS Rollovers

Webmaster Tutorials Instructional webmaster-related how-to's and tutorials.

Advanced Search
0 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 02-16-2006, 04:45 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Feb 2006
Posts: 3
luiz_itape is an unknown quantity at this point
 



CSS Rollovers


CSS Rollovers


Tired of using Javascript for your rollovers? Well, I looked a few tutorials, made some tweaks and now have a very effective way of doing them through CSS. Since IE doesn't support img:hover we'll have to stick with the good ol' a tag.

Before I show the code, I want to explain how it works.

Basically what happens, is you assign a class (must belong to the a tag) to a link. Depending whether you want to use text-links or image-links will determine whether you put text in the link or not. In that class, you set the size of the button, and attach a background that doesn't repeat and is set a position. Now, that background will have all the states (normal, hover, etc) in the one image (acts like a preloader.) On the hover you will just change the position on the image. Works really well.

Now for the code (I'll assume they're using text as their link). Your CSS
Code:
a.nav {
background-image: url(http://wac.658e.edgecastcdn.net/80658E/namepros/images/nav_link.jpg);
background-repeat: no-repeat;
background-position: -85px 0px;
display: block;
width: 85px;
height: 21px;
margin: 0; 
padding: 0; 
}
a.nav:hover {
background-position: 0px 0px;
}
Your link code
????: NamePros.com http://www.namepros.com/webmaster-tutorials/168067-css-rollovers.html
Code:
<a href="home.html" class="nav">Home</a>
It's that simple. But when you're doing it without text (having the link text in the graphic) you have to make a class for each one. I means a bit more CSS, but can make for some interesting rollovers. You can also add more states by doing something similar to the "a.nav:hover."
luiz_itape is offline  
Old 02-16-2006, 12:43 PM   #2 (permalink)
NamePros Regular
 
Rowan W's Avatar
Join Date: Dec 2004
Location: QLD, Australia
Posts: 713
Rowan W will become famous soon enough
 



I think you need to provide an example of what the image would look like, for those who don't know.
Rowan W is offline  
Old 02-24-2006, 03:49 AM   #3 (permalink)
NamePros Member
 
J4m!3's Avatar
Join Date: Oct 2005
Location: Clevedon, UK
Posts: 198
J4m!3 will become famous soon enoughJ4m!3 will become famous soon enough
 



Not bad, i would of gone in to more detail thought about what else you can and an example would be nice..
J4m!3 is offline  
Old 02-26-2006, 06:50 AM   #4 (permalink)
NamePros Member
Join Date: Dec 2005
Location: Finland
Posts: 56
purustotle is an unknown quantity at this point
 



Absolutely, an example would be nice.
purustotle is offline  
Closed Thread


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS help "pain or saint"? Maylin Website Development 5 01-05-2006 02:42 PM
PHP, Mysql, CSS Coder Needed weebguy Web Development Wanted 1 12-27-2005 07:44 AM
CSS rollovers, and adsense advice def1 Web Design Reviews 10 11-28-2005 11:26 AM
Trouble w/ CSS rollovers in IE Splinter Freelance Web Design Discussion 3 11-27-2005 12:57 PM

 
All times are GMT -7. The time now is 12:56 AM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger