Forum Moderators: not2easy

Message Too Old, No Replies

Basic Question about Font of Links

         

spica42

8:56 am on Oct 17, 2004 (gmt 0)

10+ Year Member



I'd appecitate some help because I really do not know how to do this.

I defined a style for the general font of my site.

body,td,th {
font-family: Arial;
font-size: 13px;
color: #333333;
}
a {
font-size: 13px;
color: #003366;
}
a:link {
text-decoration: none;
color: #3366cc;
}
a:visited {
text-decoration: none;
color: #3366cc;
}
a:hover {
text-decoration: underline;
color: #3366cc;
}
a:active {
text-decoration: none;
color: #3366cc;
}

-----------------------------------------------
But I would like a section in the page to have different fonts..

So I add <font style="font-family:georgia, verdana, arial, sans-serif;color:#666; font-size:10px;">{section-with-different-fonts}</font>

Everything worked except for the links in the section. I would like to change the font and size of the links too, how do I do that?

Old_Honky

11:40 am on Oct 17, 2004 (gmt 0)

10+ Year Member Top Contributors Of The Month



You could replace

<font style="font-family:georgia, verdana, arial, sans-serif;color:#666; font-size:10px;">{section-with-different-fonts}</font>

with

section-with-different-fonts{
font: normal 10px georgia, verdana, arial,sans-serif;
color: #666;
}

section-with-different-fonts a{
font: normal 10px georgia, verdana, arial,sans-serif;
color: #666;
}

section-with-different-fonts a:link,
section-with-different-fonts a:visited {
text-decoration: none;
color: #3366cc;
}

section-with-different-fonts a:hover {
text-decoration: underline;
color: #3366cc;
}

section-with-different-fonts a:active {
text-decoration: none;
color: #3366cc;
}


in your style section (changing the font size colour etc in the second style to what ever you want). If you just want the styles to be the same write the code as

section-with-different-fonts,
section-with-different-fonts a{
font: normal 10px georgia, verdana, arial,sans-serif;
color: #666;
}

section-with-different-fonts a:link,
section-with-different-fonts a:visited {
text-decoration: none;
color: #3366cc;
}
section-with-different-fonts a:hover {
text-decoration: underline;
color: #3366cc;
}

section-with-different-fonts a:active {
text-decoration: none;
color: #3366cc;
}


Then in your html just enclose everything you want to change inside a span.

<span class="section-with-different-fonts">everything you want to change</span>


As an aside I would change "section-with-different-fonts"
to something shorter.

Saltminer

4:04 pm on Oct 17, 2004 (gmt 0)

10+ Year Member



Why not just define a class, then apply that to any element you like.

body,td,th {
font-family: Arial, sans-serif;
font-size: 13px;
color: #333333;
}
a {
font-size: 13px;
color: #003366;
}
a:link, a:visited {
text-decoration: none;
color: #3366cc;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
.special {
font-family: georgia, verdana, arial, sans-serif;
color:#666;
font-size:10px}

Then you can use <p class="special"> or <a class="special"> where you want to change the font. I didn't actually test it but that should work.

spica42

4:26 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



Thanks for the help guys. This is just what I need.