Forum Moderators: not2easy

Message Too Old, No Replies

font-size related to font-family

         

8PDesign

8:24 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



hi,
I'd like to control font-size depending on WHICH font is available on the browser.

example:
font-family: "Myriad Pro", Arial, sans-serif;

IF the user has Myriad Pro installed, I'd like the font size to be 18px
If only Arial is available, then font-size should be 17px

This is because those two fonts really have different span.

How can I achieve this?

thanks!

swa66

10:17 pm on Aug 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From pure CSS 2.1 alone there is no control over this.

Javascript might give you something, and if you find support for it already, CSS3 has plans that go in the direction of adjusting the font size depending on the x-height of the selected font.

[w3.org...]

I'd avoid trying to need to have a very specific font(size) in my layout as the user ultimately can override your font choices anyway (e.g. with a minimum font size).

8PDesign

10:39 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



thanks for your reply!

Really, all I'd want is a small adjustment on users using Myriad.
Do you have a link to a javascript solution to this?

Can't wait for CS3 to shine! :)