GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 31-Jan-2004, 23:31
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about

[Tutorial] Basic CSS Hover Effects (Backgrounds, borders, ect.)


This simple effect will make normal links look just like buttons with hover effects.

We will be using HTML / CSS to do this.
Although there are many options to go with, for demonstration purposes we will have an effect with a background color, font color, border color, with specific hover effects that change those attributes.

First off. We will create the basic code in html that will be displayed on the page.

HTML Code:
<a href="http://www.domaincom" class="hoverlink">Name</a>
The above code will display a simple hyperlink. The class 'hoverlink' will contain the information to form our hover effect.

Now for the CSS:
CSS Code:
body{
	text-align: center;
	font-family: verdana;
	font-size: 10px;
	color: #6983B3;
}
.hoverlink{
	text-align: center;
	text-decoration: none;
	font-family: verdana;
	font-size: 10px;
	color: #22229C;
	background-color: #F5F5FF;
	border: solid 1px #D1D1E1;
}
.hoverlink:hover{
	border: solid 1px #6983B3;
	background-color: #E1E4F2;
}

All of the values in here should be modified to fit the rest of the layout for your site. I made the values above specifically to go with the vBulletin 3 Style here at GIDForums.

To include the CSS code in an outside CSS script, use:
HTML Code:
<link rel="stylesheet" type="text/css" href="style.css">

One tip to make the effect flow more and just outright look better, I added
HTML Code:
&nbsp;
to the right and left of the 'Name' portion of the link.

Here is a basic final effect using multiple links, and bars to represent the specific sections of the links:
HTML Code:
<font color="#6983B3">|</font>&nbsp; <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a> <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a> <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a> <font color="#6983B3">|</font>&nbsp; <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a> <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a> <a href="http://www.domain.com" class="hoverlink">&nbsp;Name&nbsp;</a>&nbsp; <font color="#6983B3">|</font>&nbsp; <a href="http://www.domain.com" class="hoverlink">&nbsp;Link 2&nbsp;</a> <font color="#6983B3">|</font>&nbsp;

Very simple tutorial, yet a very professional appeal. Might I remind you this is so much faster than trying to get the same effect while using images.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #2  
Old 01-Feb-2004, 09:53
cs2 cs2 is offline
Member
 
Join Date: May 2003
Location: California
Posts: 107
cs2 will become famous soon enough
Nice... but is there some reason you chose to use all those non-breaking spaces, instead of just setting 'padding' (once) within the CSS class? Also, this doesn't work in Netscape 4.x. In fact, it breaks the page layout.
__________________
The Whole Internet, LLC
Visit our Homepage, -or-
use our online CSS Editor
  #3  
Old 01-Feb-2004, 11:34
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
I don't see why it wouldn't work in NS4. Any ideas? I usually don't use padding for that.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #4  
Old 01-Feb-2004, 15:23
cs2 cs2 is offline
Member
 
Join Date: May 2003
Location: California
Posts: 107
cs2 will become famous soon enough
Quote:
Originally Posted by BobbyDouglas
I don't see why it wouldn't work in NS4. Any ideas?
Because NS4 always has problems with CSS! Google for...
NS4 CSS bugs
...and you'll see that it is well documented.

I just tried the padding, and it works fine (at least in IE and Opera).
__________________
The Whole Internet, LLC
Visit our Homepage, -or-
use our online CSS Editor
  #5  
Old 01-Feb-2004, 23:46
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
If it works in NS4 PM me the code and I will edit the post. Not good to have a tutorial that does not quite work all the time.
Thanks for the CSS tips.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #6  
Old 02-Feb-2004, 08:48
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Are we talking about Netscape 4 here? I personally don't bother designing for that particular version of the browser since more than a year ago... and the people who still use that browser, they deserve the mess they see

I know my post is not very constructive but I thought I'd add it just the same.
  #7  
Old 02-Feb-2004, 09:17
cs2 cs2 is offline
Member
 
Join Date: May 2003
Location: California
Posts: 107
cs2 will become famous soon enough
Yes, NS4 = Netscape 4. I agree that it is old and that the users probably deserve what they get. However, our webstats still show that over 4.5% of our visitors still use it. I'm not willing to ignore a user base that large.
__________________
The Whole Internet, LLC
Visit our Homepage, -or-
use our online CSS Editor
  #8  
Old 02-Feb-2004, 21:39
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Both good opinions. Like I said previously cs2
Quote:
If it works in NS4 PM me the code and I will edit the post.

Btw, do you prefer being called cs2?
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #9  
Old 03-Feb-2004, 09:13
cs2 cs2 is offline
Member
 
Join Date: May 2003
Location: California
Posts: 107
cs2 will become famous soon enough
Quote:
Originally Posted by BobbyDouglas
Both good opinions. Like I said previously cs2
> If it works in NS4 PM me the code and I will edit the post.
I don't understand why you are mentioning the NS4 thing again.
We already tested and I stated that it does not work (01-02-2004 08:53).


Quote:
Originally Posted by BobbyDouglas
Btw, do you prefer being called cs2?
Actually, no. The 'cs2' is just a company pseudonym -- I'm Bob, but next time it might be Candi or Maryann posting.
__________________
The Whole Internet, LLC
Visit our Homepage, -or-
use our online CSS Editor
  #10  
Old 03-Feb-2004, 12:31
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Sorry. I thought when you said 'this' in your first post you ment the method I used, and not the one you described.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:43.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.