View Full Version : Link Question
SportsInvestor
03-06-2005, 01:40 AM
I am redesigning my website and wanted to have the links on my menu bar change colors like the links on the statcounters homepage when you put your mouse on them. the problem is that i really don't know much about web design and don't know how it's done. can someone help?
thanks!!
motorwatchercounter
03-06-2005, 02:07 AM
3 ways to do it.
1 is to change each links seperately which is messy but let me know and I will explain
2 Run this from an external css file. This may be for the future if you want to experiment with running all look and feel by css
3 Put some code before the closing head tag </head>
Here is an example
<style type="text/css">
<style>
a:link { color: blue; font-family: "Andale Mono", Arial, Helvetica, Geneva, Swiss, SunSans-Regular; text-decoration: none; font-size:medium; font-weight:bold; font-style:italic; }
a:visited { color: green; font-family: "Andale Mono", Arial, Helvetica, Geneva, Swiss, SunSans-Regular; text-decoration: none }
a:hover { color: #000000; font-family: "Andale Mono", Arial, Helvetica, Geneva, Swiss, SunSans-Regular; text-decoration: underline }
</style>
If you look through this, the first part is when eg a:hover,
The next is the colour eg red or hex number,
The next is font type,
Text-decoration:none means do not show the underline,
Font-size explains itself
Font-weight can be left out or bold for example,
Font-style can be left out or something like italic
SportsInvestor
03-06-2005, 03:26 AM
Thanks for the code. i will try it. can you also explain how to do it seperately. that way i know 2 ways of doing it.
thanks again!
motorwatchercounter
03-06-2005, 03:45 AM
Try this code between the <body> </body tags>
<a href="http://www.domain.net"><font color="#FF0000" size="5" face="Verdana, Arial, Helvetica, sans-serif ">dfddghdghd
</font></a></p>
Your Link (http://www.domain.com)
</p>
dhgdthhthrrh (http://www.domain.com)</p>
The
</p> are just paragraphs and are not needed for the actual link
To get you started here is a nice list of code to get you started and building. Also check out the tips.
http://www.web-source.net/html_codes_chart.htm
SportsInvestor
03-06-2005, 10:14 PM
i tried adding the code between the head tags. only 2 of the links on my menu bar actually become underlined when you put your mouse on them....the others are the same as before. and if you look at it with firefox, nothing is different. i probably did something wrong. i don't understand code to well, but i'm learning. could you check it out to see what i messed up. the page is http://sportsinvestingguide.com/new_page_2.htm.
many thanks!
motorwatchercounter
03-07-2005, 12:52 AM
That page is down at the minute.
SportsInvestor
03-07-2005, 01:59 AM
hmm....don't know why it was done, but it's working now.
motorwatchercounter
03-07-2005, 02:25 AM
Hi,
The link should be
http://www.sportsinvestingguide.com/new_page_2.htm
Change the A;hover line to
a:hover {color: #FFFFFF; font-family: verdana; text-decoration: none }
Put this in the table
<td width="100%" bgcolor="#5394AC">
<p align="center">Home (http://sportsinvestingguide.com/newindex.htm)
| Blog (http://www.thegamblerscorner.blogspot.com) | Sports Investing? (whatis2.htm) | </font>[/b]
<a href="http://sportsinvestingguide.com/thebettorsguide.htm"><font face="Verdana" size="1" color="#FFFFFF">SIG
Gambling Guide</font></a><font face="Verdana" size="1" color="#800000">
</font><font face="Verdana" size="1" color="#DADADA"> |
</font><a href="http://sportsinvestingguide.com/fantasy2.htm"><font face="Verdana" size="1" color="#FFFFFF">Fantasy
Sports</font></a><font face="Verdana" size="1" color="#800000">
</font><font face="Verdana" size="1" color="#DADADA"> |
</font><a href="http://www.sportsinvestingguide.com/links/ThemeIndex.html"><font face="Verdana" size="1" color="#FFFFFF">Gambling
Directory</font></a><font face="Verdana" size="1" color="#FFFFFF">
</font><font face="Verdana" size="1" color="#DADADA">|</font><font face="Verdana" size="1" color="#000000">&
</font><a href="http://sportsinvestingguide.com/affiliate2.htm"><font face="Verdana" size="1" color="#FFFFFF">Affiliate
Program</font></a><font face="Verdana" size="1" color="#800000">
</font><font face="Verdana" size="1" color="#DADADA"> |
</font><font face="Verdana" size="1" color="#FFFFFF">Webmasters</font> (http://sportsinvestingguide.com/webmaster2.htm)<font face="Verdana" size="1" color="#800000">
</font><font face="Verdana" size="1" color="#DADADA"> |
</font><font face="Verdana" size="1" color="#FFFFFF">Contact</font> (guide@sportsinvestingguide.com)<font face="Verdana" size="1" color="#800000">
</font><font face="Verdana" size="1" color="#DADADA"> |</font>
</td>
I have only done the first 3. The text size changes, the colour changes and the line goes. Go back to the A:hover at the top. The white font is because you asked for #ffffff which is white. take out the #ffffff and type in red. This will change the mouse over to a red font. I have changed the hover to decoration none which means the ilne goes on hover. You can change the font by saying font size 12.
Have a go at this first and let me know when you have got it or need more help.
SportsInvestor
03-07-2005, 08:54 PM
Thanks a lot!!! i will try this when i get a chance a little later tonite.
SportsInvestor
03-09-2005, 12:54 AM
ok i re-did and added the code, but i must have done something wrong. i want the link to only be underlined when the mouse hovers over it. if you look at the site with firefox the links are underlined and blue. they turn white when the mouse hovers. take a look in IE and every thing is the same except for some reason the 2nd and 3rd links are white.
what did i mess up this time? thank you for being so patient with me!!
Sharron
03-09-2005, 05:16 AM
May I suggest that your text before roll over be the same font and size as the rollover text. Just change the color with the rollover. It appears a tad bit odd and makes me feel like my eyes are playing wif me brain.
:P
jonra01
03-09-2005, 06:41 AM
I don't see any style statements in the code. Here's how it should look. You can view the demo here http://www.jonra.com/blog/cssexample.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>CSS Example</TITLE>
<style type="text/css">
<!--
.td-mainmenu-link { /* this is the table cell style everything should be fairly obvious */
background-color: #5394ac;
width: 100%;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #211f21;
font-size: 13px;
text-decoration: none;
}
.td-mainmenu-link a { /* this sets the values for the links */
/* even though the color and text decoration are set for fonts in the main style we need to set them for links here */
color: #211f21; /* this is the font color of the link */
text-decoration: none /* this says no underline */
}
.td-mainmenu-link a:hover { /* this is where you set the values for mouseover on the links */
background-color: #ffffff; /* this changes the td background to white */
color: #5394ac; /* this changes the font color to the color that was the td background */
text-decoration: underline; /* this underlines the link on mouseover */
width: 100% /* this makes sure it fills the whole td otherwise it would just be over the text */
}
-->
</style>
</HEAD>
<BODY bgColor="#5394ac">
<table borderColor="#f4f4f4" cellSpacing="0" borderColorDark="#f4f4f4" cellPadding="0" width="250" border="1">
<tbody>
<tr>
<td class="td-mainmenu-link">Home (index.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">&</td>
</tr>
<tr>
<td class="td-mainmenu-link">
<p align="left">Other Products</p>
</td>
</tr>
<tr>
<td class="td-mainmenu-link">Other Gambling Guides (gamblinguide.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">Fantasy Sports (fantasy.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">The UpperDeck Store (http://clickserve.cc-dt.com/link/click?lid=41000000007129990)</td>
</tr>
</tbody>
</table>
</BODY>
</HTML>
John
jonra01
03-09-2005, 07:16 AM
There were a couple of missing semicolons in the first code sample. The demo is fixed and I'll add the correct code to the end of this file.
On another note, Mozilla ignores the width: 100%; It seems to do this because it applies only to the link, so the only background color change is over the text. IE on the other hand handles it the way I want it to by changing the whole td background color.
I've found a few hacks to handle the problem with div width in IE and Mozilla. A browser is supposed to add padding and margin amounts to the width of a div. Example: div {width: 100px; margin: 10px; padding: 10px;) ends up being 140px wide in Mozilla and stays 100 in IE. That means the content area ends up being only 60px in IE.
This is a different problem. Even though the style is applied to the td tag and not to the text Mozilla insists on applying the hover to the text instead of the td.
Oh well, it never ends.
John
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>CSS Example</TITLE>
<style type="text/css">
<!--
.td-mainmenu-link { /* this is the table cell style everything should be fairly obvious */
background-color: #5394ac;
width: 100%;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #211f21;
font-size: 13px;
text-decoration: none;
}
.td-mainmenu-link a { /* this sets the values for the links */
/* even though the color and text decoration are set for fonts in the main style we need to set them for links here */
color: #211f21; /* this is the font color of the link */
text-decoration: none; /* this says no underline */
width: 100%; /* this makes sure it fills the whole td otherwise it would just be over the text */ /* this does not work in Mozilla or firefox */
}
.td-mainmenu-link a:hover { /* this is where you set the values for mouseover on the links */
background-color: #ffffff; /* this changes the td background to white */
color: #5394ac; /* this changes the font color to the color that was the td background */
text-decoration: underline; /* this underlines the link on mouseover */
width: 100%; /* this makes sure it fills the whole td otherwise it would just be over the text */ /* this does not work in Mozilla or firefox */
}
-->
</style>
</HEAD>
<BODY bgColor="#5394ac">
<table borderColor="#f4f4f4" cellSpacing="0" borderColorDark="#f4f4f4" cellPadding="0" width="250" border="1">
<tbody>
<tr>
<td class="td-mainmenu-link">Home (index.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">&</td>
</tr>
<tr>
<td class="td-mainmenu-link">
<p align="left">Other Products</p>
</td>
</tr>
<tr>
<td class="td-mainmenu-link">Other Gambling Guides (gamblinguide.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">Fantasy Sports (fantasy.htm)</td>
</tr>
<tr>
<td class="td-mainmenu-link">The UpperDeck Store (http://clickserve.cc-dt.com/link/click?lid=41000000007129990)</td>
</tr>
</tbody>
</table>
</BODY>
</HTML>
motorwatchercounter
03-09-2005, 11:11 AM
May I suggest that your text before roll over be the same font and size as the rollover text. Just change the color with the rollover. It appears a tad bit odd and makes me feel like my eyes are playing wif me brain. :P
It was meant to be an introduction to css not the solution.
Rather than put the code in the thread you can save the source code from here.
www.motorwatcher.net/sportsmenu.html
This is based on your test page url which is
http://www.sportsinvestingguide.com/new_page_2.htm
:lol:
jonra01
03-09-2005, 05:46 PM
I didn't realize you had already put up some code, MWC. If I'd known that I wouldn't have created that sample page. Athough, I did learn a few things while doing it. Everything is a learning experience with me. :)
John
motorwatchercounter
03-09-2005, 06:27 PM
I didn't realize you had already put up some code, MWC. If I'd known that I wouldn't have created that sample page. Athough, I did learn a few things while doing it. Everything is a learning experience with me. :) John
No problems. There is nothing worse than no replys. For me the more contributions, the better.
SportsInvestor
03-09-2005, 08:04 PM
wow, thanks all for the responses and help. i'm learning as i go. i don't learn well by reading, i learn by doing......and a lot of times its doing it over and over. all the same i agree with john....everything is a learning experience.
thanks again all of you for the help and comments. it very much appreciated.
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.