Hi,
I’ve been using this to colour my links etc.:
<style type=”text/css” media=”screen”>
<!–
a.leftlink:link {
color: #0000FF;
background-color: #FFFFFF;
}
a.leftlink:visited {
color: #990000;
background-color: #FFFFFF;
}
etc……………..
and then in the body:
<div>
<p><a class=”leftlink” href=”#”>Hello</a></p>
<p><a class=”leftlink” href=”#”>Goodbye</a></p>
<p><a class=”leftlink” href=”#”>Hi</a></p>
</div>
However I’ve also used this which I have now been told is incorrect:
<style type=”text/css” media=”screen”>
<!–
.rightlink a:link {
color: #0000FF;
background-color: #FFFccc;
}
.rightlink a:visited {
color: #990000;
background-color: #FFFccc;
}
etc………………..
and in the body:
<div class=”rightlink”>
<p><a href=”#”>Hello</a></p>
<p><a href=”#”>Goodbye</a></p>
<p><a href=”#”>Hi</a></p>
</div>
The point being that in the second version there is a lot less code especially if there are a lot of links as you can just set the class in the div.
In the first version the class has to be put in every anchor tag.
I’ve been told that the first version is the correct way to code but the second version seems much neater to me and seems to work in current browsers.
Is there a problem in coding it this way? I’ve had a look at W3c and their example is like the first version. Any advice would be welcome.
Paul