Web Hosting Talk







View Full Version : Changing font in a link with CSS???


RoyFeni
08-14-2005, 06:22 AM
All I want to do is have something like an <h2> at the top of a list, but it has to be a link. font-family and font-weight seem to have NO EFFECT on a link, so I have to put an <h2> (with the font-family and font-weight attributes I want) inside the anchor tag. But then it doesn't change color when the user visits the site!

How can I change the font in a link with CSS?

DevilDog
08-14-2005, 07:22 AM
Assuming you already have your class defined in CSS and the name of it is "text", the hyper link would look like this:

<a href="link.html" class="text">link</a>

RoyFeni
08-14-2005, 09:06 AM
Originally posted by DevilDog
Assuming you already have your class defined in CSS and the name of it is "text", the hyper link would look like this:

<a href="link.html" class="text">link</a>

Tried that, Dude. Didn't work with font-family or font-weight.

:bawling:

phos
08-14-2005, 02:12 PM
Maybe you're defining them wrong? That should work.
Also, one thing to keep in mind an <a> should be within a text tag like <span> or <p>.

stripeyteapot
08-14-2005, 03:06 PM
What font are you trying to use?

a {font-family: Arial, Helvetica, sans-serif;}
<a href="hyperlink.html">My Link</a>

Or

a.link {font-family: Arial, Helvetica, sans-serif;}
<a href="hyperlink.html" class="link">My Link</a>

Or

.link a {font-family: Arial, Helvetica, sans-serif;}
<div class="link">This is my section, that has a different link style, here is <a href="hyperlink.html">my link</a>.</div>

Hope that helps.

Musoka
08-15-2005, 09:04 PM
If its in a H2 shouldnt it be...

h2 a:link {
blah:2132;
}

Or h2 a alone?

Oliver Twist
08-16-2005, 09:30 PM
This website should give you other idea's on css, it is certainly worth a visit @

mandarindesign.com

RoyFeni
08-16-2005, 10:22 PM
Originally posted by Musoka
If its in a H2 shouldnt it be...

h2 a:link {
blah:2132;
}

Or h2 a alone?

Tried that too! Of course, if I could change the font in the <a> tag, I wouldn't need the <h2>....


(Thanks for all the ideas, guys!)