Click to See Complete Forum and Search --> : Changing link colors via style attributes?


J.Fox
01-08-2007, 03:00 AM
Is it possible to change the colors of links in a <span> or <div> tag using the style attribute?

If not, is there any easy way (JavaScript perhaps?) to do this?

NogDog
01-08-2007, 03:14 AM
<a href="somepage.html" style="color: #ff0000;">Link Text</a>

And there are a number of ways you could control it via CSS stylesheets and class/id attributes in your HTML.

<html>
<head>
<title>sample</title>
<style type="text/css">
.sample { color: #000000; }
.sample a { color: #ff0000; }
</style>
</head>
<body>
<p class="sample">This is black. <a href="test.html">This is red.</a> Back to black.</p>
</body>
</html>