Action, protest, campaigns, demos and issues magazine features, photos, articles, stories photos of London, New York, Wales, England and photography features music, parties, clubs, events, records, releases drug information, harm reduction, no-nonsense guide punch a celebrity football, features, issues, cardiff city games, useless games and diversions technical info, web authoring, reviews and features site news, updates and urban75 blog urban75 community news and events urban75 bulletin boards join the chatroom search urban75 back to urban75 homepage
London features, photos, history, articles New York features, photos, history, articles Brixton features, photos, history, articles panoramas, 360 degree vistas, London, New York, Wales, England Offline London club night festival reports, photos, features and articles urban75 sitemap and page listing about us, info, FAQs, copyright join our mailing list for updates and news contact urban75
web question and answers



« Q & A page

« tech pages


Q: Text effects with Cascading Style Sheets
by Mike Slocombe

Q: Here's the effect I'm trying to achieve: On the left of my page, textual navigation with these properties: underline only appears when the mouse hovers over the link, or the link is active. There is no difference in appearance between visited and non-visited links. On the right, the body text, in which links are always underlined, and visited links change colour. I've sweated over this for hours, and achieved a curious variety of results, but can't get it to look the way I want it. Am I expecting too much of CSS1, or am I missing something? David Allison

A: Style sheets can appear a bit fiddly at first, but with a bit of patience things soon become clear!

You can get the effect you want by creating individual classes for the different links in your style sheets and then referring to them in the <A HREF=""> tag on your page:

<html>
<head>
<title></title>
<style type="text/css">

/* left hand links */

A.test {
color : black;
font-family : Verdana, Arial, Helvetica, sans-serif;
text-decoration : none;
font-size : 11px; } A.test:active {
color : red;
text-decoration : underline;
}
A.test:visited {
color : black;
text-decoration : none;
}
A.test:hover {
color : green;
text-decoration : underline;
}

/* body links */

A.test2 {
color : blue;
font-size : 14px;
font-family : Verdana, Arial, Helvetica, sans-serif;
text-decoration : underline;
}
A.test2:active {
color : red;
text-decoration : underline;
}
A.test2:visited {
color : Gray;
text-decoration : underline;
}
A.test2:hover {
color : green;
text-decoration : underline;
}

</style>
</head>

<body>
<a href="test.html" class="test">left hand links</a>
<a href="test.html" class="test2">body links</a>
</body>
</html>


Bear in mind that the 'hover' effect only works in Netscape 6/IE5+ and that there can be all manner of annoying discrepancies between browsers - test carefully first!

Any old text editor will do for building style sheets but serious users might want to check out the fabulous TopStyle (PC only) or look up the list of editors and validators at http://www.w3.org/Style/CSS/

There's some useful on line tutorials available for learning CSS including Guide to Cascading Style Sheets, CSS tutorial and w3c Style Sheet Guide

May 2004




urban75 - community - action - mag - photos - tech - music - drugs - punch - football - offline club - brixton - london - new york - useless - boards - help/FAQs - © - design - contact - sitemap - search