Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > css and font-size

Reply
Thread Tools

css and font-size

 
 
steve
Guest
Posts: n/a
 
      12-02-2003
Hi

I think I miss one of the css lessons

I have table in a table, they both have the same style
{font-family:arial; font-size:75%;}
why does it the table in site of the other table apply the css 2 times
and the text size is not 75% but is something like 50%
why is that?
do I miss one lesson in css?

here is a sample http://www.watchestelltime.co.za/testcss.htm

or here you can se the code

<html>
<head>
<style>
..razmer {font-family:arial; font-size:75%;}
</style>
</head>
<body>
<table width="50%" border="1" class="razmer">
<tr>
<td>this is text in table 1<br>
<br>
<table width="50%" border="1" class="razmer">
<tr>
<td>this is text in tale 2</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>


 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      12-02-2003
in post <news:bqgl7o$rsh$(E-Mail Removed)>
steve said:

> I have table in a table, they both have the same style
> {font-family:arial; font-size:75%;}


thats is 25% smaller than your visitors preferred size - unreadable

> why does it the table in site of the other table apply the css 2 times
> and the text size is not 75% but is something like 50%
> why is that?


font is initially 75% defined again at 75% is 75% of 75%


--
brucie
02/December/2003 10:09:39 am kilo
 
Reply With Quote
 
 
 
 
Eric Bohlman
Guest
Posts: n/a
 
      12-02-2003
"steve" <(E-Mail Removed)> wrote in news:bqgl7o$rsh$1@ctb-
nnrp2.saix.net:

> I have table in a table, they both have the same style
> {font-family:arial; font-size:75%;}
> why does it the table in site of the other table apply the css 2 times
> and the text size is not 75% but is something like 50%
> why is that?
> do I miss one lesson in css?


Yep, the lesson where they should have taught you that relative values for
font sizes are always relative to the *computed* size used by the enclosing
element. "font-size: 75%" means "make the font size three-quarters of what
it would have been if I hadn't specified a font size for this element." So
in your outer table, the font size is 75% of what it would be outside the
table (in your example, that means 75% of the browser's default size), and
in your inner table, it's 75% of what it is in the outer table (i.e. what
it would be if you hadn't specified a style for the inner table), which
works out to 56.25% of the default size.

One of the more confusing aspects of CSS is that for some properties (like
font size), percentage values are relative to computed values, while for
other properties they're relative to set values. Keep a copy of the spec
handy!
 
Reply With Quote
 
Sid Ismail
Guest
Posts: n/a
 
      12-02-2003
On Tue, 2 Dec 2003 02:09:30 +0200, "steve" <(E-Mail Removed)>
wrote:

: Hi
:
: I think I miss one of the css lessons
:
: I have table in a table, they both have the same style
: {font-family:arial; font-size:75%;}
: why does it the table in site of the other table apply the css 2 times
: and the text size is not 75% but is something like 50%
: why is that?

75% of 75% = 56.25%
75% of the font size (already 75%)...

: do I miss one lesson in css?

You may have missed two actually...

Sid

 
Reply With Quote
 
steve
Guest
Posts: n/a
 
      12-02-2003
> > I have table in a table, they both have the same style
> > {font-family:arial; font-size:75%;}
> > why does it the table in site of the other table apply the css 2

times
> > and the text size is not 75% but is something like 50%
> > why is that?
> > do I miss one lesson in css?

>
> Yep, the lesson where they should have taught you that relative

values for
> font sizes are always relative to the *computed* size used by the

enclosing
> element. "font-size: 75%" means "make the font size three-quarters

of what
> it would have been if I hadn't specified a font size for this

element." So
> in your outer table, the font size is 75% of what it would be

outside the
> table (in your example, that means 75% of the browser's default

size), and
> in your inner table, it's 75% of what it is in the outer table (i.e.

what
> it would be if you hadn't specified a style for the inner table),

which
> works out to 56.25% of the default size.
>
> One of the more confusing aspects of CSS is that for some properties

(like
> font size), percentage values are relative to computed values, while

for
> other properties they're relative to set values. Keep a copy of the

spec
> handy!


Were can I find a list or sample or some kind of tutorial of which
properties are relative to what and which one are not


 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      12-02-2003
Quoth the raven named Eric Bohlman:
....
> Yep, the lesson where they should have taught you that relative values for
> font sizes are always relative to the *computed* size used by the enclosing
> element. "font-size: 75%" means "make the font size three-quarters of what
> it would have been if I hadn't specified a font size for this element." So
> in your outer table, the font size is 75% of what it would be outside the
> table (in your example, that means 75% of the browser's default size),


Isn't is true that (in a good browser, I suppose) a table will inherit
from body, rather than "browser's default size?" IOW, if the author
mistakenly assigns a /body/ font of 75%, the outer table is 75% of
75%, and the inner table is 75% of 75% of 75% .. well, you get the idea.

But by this time, I've left for another site I can read.

--
-bts
-This space intentionally left blank.

 
Reply With Quote
 
Marc Nadeau
Guest
Posts: n/a
 
      12-02-2003
steve a écrit:

>
> Were can I find a list or sample or some kind of tutorial of which
> properties are relative to what and which one are not


http://www.w3.org/TR/2003/WD-CSS21-2...5/propidx.html

This is not a tutorial but 'the' reference.

Well written, informative and downloadable.

--
Quand on regarde le ciel dans l'eau, on voit les poissons dans les arbres.
Sancho P.

 
Reply With Quote
 
Eric Bohlman
Guest
Posts: n/a
 
      12-02-2003
"Beauregard T. Shagnasty" <(E-Mail Removed)> wrote in
news:3fTyb.155301$(E-Mail Removed):

>> font size for this element." So in your outer table, the font size
>> is 75% of what it would be outside the table (in your example, that
>> means 75% of the browser's default size),

>
> Isn't is true that (in a good browser, I suppose) a table will inherit
> from body, rather than "browser's default size?" IOW, if the author
> mistakenly assigns a /body/ font of 75%, the outer table is 75% of
> 75%, and the inner table is 75% of 75% of 75% .. well, you get the
> idea.


That's why I qualified my statement with "in your example" since I don't
recall him setting a font size on the body. You're right, of course, that
had he done so, his page would *not* be in a state of grace.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS MENU and CSS photo gallery desjardins.daniel@gmail.com Javascript 1 02-19-2006 06:22 PM
Whining and bitching about MSIE 6 CSS bugs and CSS support =?ISO-8859-1?Q?G=E9rard_Talbot?= HTML 0 07-09-2005 06:48 AM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
Is there a way to set the a CSS property to be explicitly the same as another CSS property? Joshua Beall HTML 1 12-10-2003 07:21 PM
print.css and screen.css tom watson HTML 1 09-09-2003 02:48 PM



Advertisments