| View previous topic :: View next topic |
| Author |
Message |
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Sun Mar 23, 2008 8:39 am link color |
|
|
|
Hello
Lets say we have:
| Code: |
| <a href="http://www.w3schools.com">http://www.w3schools.com</a> |
I would like the link in page to be blue except the part w3schools to be red
when mouse is over the link to be black entire
how can I do that? Lets say blue link is by default on wet pages, so that is solved
what about else? CSS?
thank you
Last edited by andrejanubis on Mon Mar 24, 2008 2:05 am; edited 4 times in total |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8315 Location: Castle Pines North, CO USA
|
Posted: Sun Mar 23, 2008 11:23 am |
|
|
|
Well you could define it in your style sheet - you do have one, right? I don't know exactly what page you are on over there on the W3, but
| Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Untitled 1</title>
<style type="text/css">
a:link {
color: #000080;
}
a:visited {
color: #000080;
}
a:hover {
color: #000080;
text-decoration:none;
}
a:active {
color: #000080;
}
</style>
</head>
<body>
<a href="http://www.example.com">Example</a>
</body>
</html> |
Will make the link blue.
_________________
Corey
Toll Free Fax Solutions | Mile High Merchant Accounts | Expression Web Blog |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Sun Mar 23, 2008 12:53 pm |
|
|
|
| Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<style type="text/css">
body { background: black; }
a { font-size:22px; text-decoration:none; }
a:link { color:blue; }
a:visited { color:pink; }
a:hover { color:black; background:white; font-weight: bold; }
a:active { }
</style>
</head>
<body>
<a href="http://www.w3schools.com">www.<span style="color:#ff0000"
>w3scho - hoverd should be black - ols</span>.com</a>
</body>
</html> |
I would like the link in page to be blue except the part w3schools to be red
when mouse is over the link I would like to be all black on white background
thank you |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Sun Mar 23, 2008 1:14 pm |
|
|
|
the easy way out :
| Code: |
| span:hover { color: black; } |
but is impossible, right |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8315 Location: Castle Pines North, CO USA
|
|
Airick1994
Joined: 20 Dec 2007 Posts: 101 Location: Canada, eh?
|
Posted: Sun Mar 23, 2008 7:11 pm |
|
|
|
Try this.
In your style sheet, write:
| Code: |
a.red {
color: #ff0000;
} |
Then, write the following html:
| Code: |
<a target="_blank"
href="http://www.w3schools.com"
title="HTML XHTML CSS Tutorials References Examples">
http://www.<a target="_blank" href="http://www.w3schools.com" class="red" title="HTML XHTML CSS Tutorials References Examples">w3schools</a>.com</a> |
To be honest, I haven't tried this, so I don't know if it will work. I mean, a span would work just as good, but just incase you don't want to do that, there is this. Try it. |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Mon Mar 24, 2008 2:00 am |
|
|
|
| Airick1994 wrote: |
Try this.
Then, write the following html:
| Code: |
<a href="http://www.w3schools.com"
>http://www.<a href="http://www.w3schools.com" class="red">w3schools</a>.com</a> |
|
I would like whole link to be selected, this is not |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Mon Mar 24, 2008 2:07 am |
|
|
|
| Corey Bryant wrote: |
If you are using the <span> (inline) element, it is going to over write what you have in the internal style sheet due to the cascading.
|
how to go around this |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Mon Mar 24, 2008 2:12 pm |
|
|
|
Thank you, but I got it! Here it is:
| Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<style type="text/css">
body { background: black; color:white; }
a { font-size:22px; text-decoration:none; }
a:link { color:blue; }
a:visited { color:pink; }
a:hover { color:black; background:white; font-weight: bold; }
a:active { }
span { color:red; }
span:hover { color:green; }
</style>
</head>
<body>
<a href="http://www.w3schools.com">www.<span>w3scho - hoverd should be black - ols</span>.com</a>
</body>
</html> |
|
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Thu Mar 27, 2008 1:55 am |
|
|
|
I would like to whole link to be black if mouse is over the part where originali is blue
If I hover over .com in the link that part link is black but in the middle is still red |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8315 Location: Castle Pines North, CO USA
|
Posted: Fri Mar 28, 2008 5:58 am |
|
|
|
Try using
| Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<style type="text/css">
body { background: black; color:white; }
a { font-size:22px; text-decoration:none; }
a:link { color:blue; }
a:visited { color:pink; }
a:hover { color:black; background-color:white; font-weight: bold; }
a:active { }
span { color:red; }
span:hover { color:black; }
</style>
</head>
<body>
<a href="http://www.w3schools.com">www.<span>w3scho - hoverd should be black -
ols</span>.com</a>
</body>
</html> |
_________________
Corey
Toll Free Fax Numbers | Yahoo Merchant Account |
|
andrejanubis
Joined: 23 Mar 2008 Posts: 10 Location: Slovenia, Europe
|
Posted: Fri Mar 28, 2008 9:23 am |
|
|
|
| this site realy helpt me, thank you |
|
kingly
Joined: 03 May 2008 Posts: 1
|
Posted: Sat May 03, 2008 6:06 pm |
|
|
|
| Thank for good shared. |
|
|