 SentinelPremium join:2001-02-07 Florida kudos:1 | CSS table link font size help please?I'm guessing this will be an easy one for someone.
I am trying to make a page with a table in it and I want all the links on the page to be 12pt but I want the links in a table to be 8pt.
If, in my CSS I set the following:
<style>
A {font-size:12pt;}
BODY {font-size:8pt;}
TABLE {font-size:10pt;}
</style>
Then it doesn't work the way I want. So is there a way for me to define that all links on the page that are not in a table are a certain size but the links that are inside the table are a different size? |
|
|
|
 Reviews:
·AT&T Southwest
·Charter
4 edits | To target the links inside the table, do this:
table a { font-size: 10pt }
btw, pt is for print, not the web. pt is a unit of measurement equal to 1/72 inch. You never know what screen size the user has. |
|
 SentinelPremium join:2001-02-07 Florida kudos:1 | Great! Thank you. I'll try that. 
So what should I use if I want the font size to be a certain size? |
|
 Reviews:
·AT&T Southwest
·Charter
| That's a subject of debate among some people and it sometimes depends on the context of the text. Most people use px which will set the size to the pixel level. But some prefer 'em' which will set the font relative to the current font size. Still others prefer percent '%' which will make it a percent of the size of the parent element.
This seems to be an article I see a lot of people seem to refer to but I might refer you to this one by the W3C themselves. |
|
 stray join:2000-01-16 Warren, NJ | reply to Sentinel A bit of refinement in the usage of font-size with %. The percent usage will make your selector's font size a percent of the size of the parent elements font-size, not a percentage of the actual parent element.
Here's a neat JQuery trick, if you want your font-size to be a percentage of the browser window height (or width.)
function winReshape() { $('table a').css('fontSize', function() { return ($(window).height() / 24) + "px" }); }
$(document).ready(function(){ winReshape(); });
$(window).resize(function() { winReshape(); });
In this example, the Javascript function winReshape() makes sure that the font-size (CSS) and fontSize (js) for 'table a' is always 1/24 of the browser window height. $(window).height() gives you the height of the browser window in pixels, which is then divided by 24 and applied to the CSS font-size of 'table a'.
winReshape() needs to be called when the document is first loaded, and subsequently whenever you resize the browser window.
-- V-Rtifacts - When Virtual Reality Was More Than Virtual |
|
 SentinelPremium join:2001-02-07 Florida kudos:1 | reply to howardfine Thank you. |
|