...

View Full Version : Can't remove underline from links



bbcs
02-09-2005, 03:10 AM
Hi all,

Here is the header section from the web page I'm trying to create:

<head>
<style>
<!-- Hide from older browsers
a:link {color: #c0c0c0; text-decoration: none;}
a:visited {color: #c0c0c0; text-decoration: none;}
a:hover {color: #0000FF; text-decoration: none;}
a:active {color: #FFFFFF; text-decoration: none;}
// end hiding contents -->
</style>
</head>

Each link looks OK *after* I click on it - i.e. no underline, hover changes to blue, last clicked changes to white, visited are grey. However, when the page is initially loaded ALL links are blue and underlined.

This is for a navigation menu, and I really don't want underlines at all.

I've tried the page in IE6 and Firefox, so unfortunately I don't think I can blame MS this time. Can someone please tell me what I've done wrong before I spit the dummy and convert all my text links to graphics? Any help would be greatly appreciated.

ArcticFox
02-09-2005, 03:18 AM
If we could see the actual page, or if you would paste the complete code, it would help us a lot more...


Questions:
Are you on a 'free' host?
Have you checked your browser settings?

:)

rmedek
02-09-2005, 03:18 AM
Try:

a { color: #c0c0c0; text-decoration: none; }

I don't know why, but that usually works better for me than a:link when declaring global style on links...

bbcs
02-09-2005, 04:16 AM
If we could see the actual page, or if you would paste the complete code, it would help us a lot more...


Questions:
Are you on a 'free' host?
Have you checked your browser settings?

:)

Thanks, Arctic.

I can't post the full page details, as it's a top-secret ASIO page detailing the suspected whereabouts of the Easter Bunny (seriously, I can... but only if I change some info first, which I will do if need be).

It's not a free host.

I'm not sure exactly which browser settings apply. Currently IE's "Underline Links" option is set to "always".... BUT, as I said earlier, the links do appear as I expect after they have been clicked ie, the underline disappears, and colors are correct.

bbcs
02-09-2005, 04:20 AM
Try:

a { color: #c0c0c0; text-decoration: none; }

I don't know why, but that usually works better for me than a:link when declaring global style on links...

I tried this (replacing the a:link line with the above, but keeping the rest), there was no change. Or did you mean to remove all the other lines? I really do want the different colors for hover etc...

Thanks for your help.

_Aerospace_Eng_
02-09-2005, 04:22 AM
you dont have any other type of inline styling do u on your links? like maybe a <u> tag?

bbcs
02-09-2005, 11:43 AM
you dont have any other type of inline styling do u on your links? like maybe a <u> tag?

No <u>s.... I have published a test page which shows the problem, the URL is http://blayneybytes.com/htmltest

Thanks Aerospace_Eng & others for your help.

rmedek
02-09-2005, 12:02 PM
oh, man...

Your problem is that the ONLY part of your website so far that's coded correctly is the stuff we gave you :p.

The short answer might be that you need to declare links inside table cells as well:

td a { properties }

The long answer is, here's what you're going to need before things like links are going to be underlined or not:

- some kind of doctype
- a <html> tag
- proper style tags (<style type="text/css">)

And then there are other things, like deprecated tags (tags that are not supported anymore in certain doctypes), using tables for layout...

Don't get too worried, though; it seems as if you are a beginner at this, and there's no better time then now to learn how to do it all right. Check out a few of these great tutorials...

http://htmldog.com
http://www.w3schools.com

HTML is easy, but it does take a little "homework" to get a grasp of how it works. Hope this helps,

_Aerospace_Eng_
02-09-2005, 12:25 PM
rmedek just touched base on a few problems but about your css to style your links its those words u have in your comments that are making it not work, change your css for your links to this

<style type="text/css">
<!--
a {color: #c0c0c0; text-decoration: none;}
a:visited {color: #c0c0c0; text-decoration: none;}
a:hover {color: #0000FF; text-decoration: none;}
a:active {color: #FFFFFF; text-decoration: none;}
-->
</style>
and the rest well u gotta start somewhere

rmedek
02-09-2005, 12:31 PM
rmedek just touched base on a few problems but about your css to style your links its those words u have in your comments that are making it not work
That's the third time this week I overlooked an easy way to solve a problem... I need to relaaax :o

bbcs
02-09-2005, 12:35 PM
Ouch!

Well, I'm not entirely an HTML newbie - I was writing it 10 years ago (when all of that stuff was legitimate code)... but I admit to have only just started again after a few years off in the wilderness.

In fact, a few years ago, I looked at CSS and stopped, because it just didn't work at all in either IE or Netscape - I forget which.

I have never seen any page that didn't work because it didn't have a doctype or <html> tag, but I guess things can change.

As for tables for layout, I have never found a design I couldn't create using them. However, I suppose it might be time to get out of the stone age... I promise to check out the links you provided.

I'll try the last couple of suggestions, and report the results.

Thanks guys :)

bbcs
02-09-2005, 12:49 PM
Problem solved! Aerospace_Eng & RMedek, I owe you a beer.

I know I have a lot to catch up on.... like for example in the new age, comments can't actually contain comments ;-)

Thanks heaps for your help guys :)

_Aerospace_Eng_
02-09-2005, 12:54 PM
:( im not old enough to drink a beer in the US legally but i guess u'll have to buy two for rmedek

rmedek
02-10-2005, 11:38 AM
I know I have a lot to catch up on.... like for example in the new age, comments can't actually contain comments ;-)
Well, remember, the comments bit is only to keep browsers that don't understand <style> from reading the text within. Browsers that do understand style read the text, so they read the extra stuff you type in, too. You can enter comments in stylesheets like so:

/* commenting here */

BTW, you can actually leave those comment tags out, it's very rare nowadays for a browser to trip on that part.


:( im not old enough to drink a beer in the US legally but i guess u'll have to buy two for rmedek

No way, man, you earned it. I won't tell :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum