Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrinking link size w/ % font-size

Status
Not open for further replies.

pindky

Programmer
Apr 26, 2002
101
US
Hello,

My linked text is smaller than my text. I used the following CSS code:

.main {
margin-right: 10px;
margin-top: 15px;
margin-left : 50px;
margin-bottom : 0px;
color: #330000;
font-size: 85%;
line-height : 18px;
font-weight: normal;
}

.main a:link {
color: #330000;
text-decoration: underline;

}

.main a:visited {

color: #330000;
text-decoration: underline;
}

.main a:hover {

background-color: #cc9966;
text-decoration: none;
color: white;
}

The class is contained in the <p> tags.

Thanks!
 
Hi spindky,

To see , whats really going on, we have to see your HTML code, but maybe the following cause your problem?

Because your font-size is &quot;%&quot; and you might have a class in a class wich make the font-size 85% of 85%, like:

<body>
<p class=&quot;main&quot;>
just a text
<a class=&quot;main&quot; href=&quot;blabla.html&quot;>link</a>
</p>
</body>

In that case you only have to code:

<body>
<p class=&quot;main&quot;>
just a text
<a href=&quot;blabla.html&quot;>link</a>
</p>

If not, then show the HTML code,

Hope this helps,
Erik
<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
This may be because there is no other font size specfied on the page, 85% of what?

% is a relative length unit
&quot;a relative length unit specifies a length in relation to another length property&quot; - MSDN
 
That is just the code for one of the styles on the sheet.

The P style just lists font-family, however.

I thought that % fonts are relative to the font size of the visitors base font size on their (user) computer. So, it would be 85% of the users base font size.

Anyone??

-pindky
 
As I said:

SHOW THE HTML CODE !!

Then we can see what really happens !!

Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Yes pindky, you are right.
But you have to be careful about this due to the rules of css classes inheritance.
Your classes are ok, but we don't see how do you use them.
Boomerang showed you an example what can happen in case of two nested <p> tags.

It's impossible to tell you what's the reason for your problem without looking at your html code.
 
Okay - here it is!

Code:

<h1>Office Services: <span class=&quot;orange&quot;>Clutter Control</span></h1>

</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=&quot;left&quot; valign=&quot;top&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;25%&quot; align=&quot;left&quot; valign=&quot;top&quot;>
<p class=&quot;calloutbox&quot;> How much is your clutter costing you?</p>
<p class=&quot;calloutbox&quot;>Disorganization costs executives 1 hour every
day, up to six weeks per year. </p>
<p class=&quot;calloutbox&quot;>The person who works with a messy desk spends,
on average, 1 1/2 hours per day looking for things. That's 7 1/2
hours per week! </p>

<p class=&quot;callout&quot;>&nbsp;</p>
<p class=&quot;callout&quot;>&nbsp;</p>
<p class=&quot;callout&quot;>&nbsp;</p>
<p class=&quot;callout&quot;>&nbsp;</p>
</td>
<td width=&quot;75%&quot; align=&quot;right&quot; valign=&quot;top&quot;>
<h2 class=&quot;faq&quot;>Organize Plus will help you:</h2>
<p class=&quot;main&quot;>Establish a neat and efficient workspace that will
reduce stress and improve your productivity.</p>
<p class=&quot;main&quot;> Reorganize any room in your office or work place
to improve traffic flow and ergonomics.</p>
<p class=&quot;main&quot;> Organize desks and files so you can find what you
need when you need it.</p>
<p class=&quot;main&quot;> Unclutter and systematize <a href=&quot;closets.htm&quot;>closets</a>,
cabinets and storage areas.</p>

<p class=&quot;main&quot;>&nbsp;</p>
<p class=&quot;main&quot;>&nbsp;</p>
<p class=&quot;main&quot;>&nbsp;</p>
</td>
</tr>
 
When I copy the HTML code + CSS code in a new file I can't see there is any problem (IE4.0 and IE5.5)

But I suggest you change your CSS code and make unique classes for the <P> and <A> , something like:

<style>
.main {
margin-right: 10px;
margin-top: 15px;
margin-left : 50px;
margin-bottom : 0px;
color: #330000;
font-size: 85%;
line-height : 18px;
font-weight: normal;
}

a.deflink:link {
margin-right: 10px;
margin-top: 15px;
margin-left : 50px;
margin-bottom : 0px;
color: #330000;
font-size: 85%;
line-height : 18px;
font-weight: normal;
text-decoration: underline;

}

a.deflink:visited {

color: green;
text-decoration: underline;
}

a.deflink:hover {

background-color: #cc9966;
text-decoration: none;
color: white;
}
</style>

and add both like:

<p class=&quot;main&quot;> Unclutter and systematize <a class=&quot;deflink&quot; href=&quot;closets.htm&quot;>closets</a>,
cabinets and storage areas.</p>

Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top