Forum Moderators: not2easy

Message Too Old, No Replies

css font size help

css font size help

         

meanweaver

2:33 pm on Sep 16, 2004 (gmt 0)

10+ Year Member



I am converting my site to css to get rid of all the tables, I am using a well known site site for help with css code, while doing so i have found some css that i cant work out, it is the font size, why has it been given 2 sizes, I know i could just leave one size there but there must be a reason, my guess is that some browser's may not understand the 0.7em so read the 1.5 instead, am i thinking along the correct lines. Below is a sample of the code.

body {
background: #cbdea8;
font: 0.7em/1.5 Geneva, Arial, Helvetica, sans-serif;
}

Regards Ian

jetboy_70

2:43 pm on Sep 16, 2004 (gmt 0)

10+ Year Member



The second value is the line height (which should have units like px, em etc.) and can be safely left out if you don't want to specify it.

One of the CSS forum moderators, SuzyUK, has covered font shorthand declarations in detail here:

[webmasterworld.com ]

Message 42

jetboy_70

4:46 pm on Sep 16, 2004 (gmt 0)

10+ Year Member



And on message #64 she states that you don't need units on line height after all. My bad.

createErrorMsg

8:59 pm on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you don't need units on line height after all

I believe adding a unit causes a specific height, whereas omitting the unit uses the number as a multiplier of the element's font size.

So...
p {
font-size: 10px/2.0;
}
...gives a line-height of 20px.

drbrain

9:13 pm on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



createErrorMsg: Exactly. Straight from CSS2:

[w3.org...]

meanweaver

10:31 pm on Sep 16, 2004 (gmt 0)

10+ Year Member



Thanks for the replys, never expected so much information, thankyou very much,

Regards