//flex table opened by JP

Click to See Complete Forum and Search --> : CSS links...


cusimar9
05-10-2005, 06:39 PM
Something is going seriously wrong with my CSS for hyperlinks...

What's wrong with this? Its not affecting the text at all...

CSS File:

.mainlink a:link, .mainlink a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
text-decoration: none;
}

.mainlink a:hover, .mainlink a:active {
color: RGB(100,100,255);
}


Link:

<a href="http://www.google.co.uk" class="mainlink">Google </a>

kpm547
05-10-2005, 07:59 PM
I believe you have the tag and class reversed. Try this:


a:link, a:visited

.mainlink {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
text-decoration: none;
}

a:hover, a:active

.mainlink {
color: RGB(100,100,255);
}

cusimar9
05-11-2005, 03:59 AM
That worked!

But now some other links of mine have gone dodgy...

Is this right for multiple link styles?

a:link, a:visited

.mainlink {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
text-decoration: none;
}

.toplink {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
text-decoration: none;
}

a:hover, a:active

.mainlink {
color: RGB(100,100,255);
}

.toplink {
color: RGB(100,100,255);
}

tantone
05-11-2005, 11:14 AM
I think you were on the right track.

Life becomes a lot easier when you define link styles for a whole section so that you don't have to put in the class for each link.

Example:
Let's say I have a section called menubar. I'd set it up as an id instead of a class.

#menubar {
properties...properties...properties...
}

I want all of the links to appear a certain way on this menubar.

#menubar a:link, #menubar a:visited, #menubar a:hover, #menubar a:active {
properties...properties...properties...
}

---------------------------------------------

Now in the html itself, you would do a simple, no-frills link and let the CSS do it's job.

<div id="menubar">
<a href="link">website</a>
</div>

---------------------------------------------

Essentially, what you're trying to do is boil down your html code to the very basics, and use the CSS document to turn those basics into anything you like. The fewer class/id declarations you use on things like links or headings, the easier it is to completely redesign your site without even having to touch the html again.

cusimar9
05-11-2005, 06:56 PM
That's cool... :D

I'm starting to like CSS ;)

I still haven't given up frames yet though :p

tantone
05-11-2005, 07:00 PM
We'll wear you down! :D :t