3 replies [Last post]
Last seen: 18 years 18 weeks ago
Joined: 2004-09-24
Posts: 1
Points: 0

Hi, I wonder if someone could help with a small issue...
I've set up a site where I have been asked to embed a non standard font and it works fine in IE.
The problem is of course that as mozilla doesnt support font embedding, it will just have to use a standard font and be done with it, but the font that I have been asked to you has to be something daft like 22pts to be readable. This means that when viewing the site with firefox the text is far too big.

Is there any way I can specify within the css file that if it uses one font then it should be one size, but a different font should be another size?

This is otherwise a very basic/cheap site and the host doesnt support asp/php otherwise I would just get it to query the browser type as a way round it, but I can't here.

Any suggestions? Many thanks in advance.

Last seen: 18 years 16 weeks ago
Timezone: GMT-6
Joined: 2004-10-08
Posts: 40
Points: 0

Font size depending on font family

You could rely on the attribute selectors. Have a look at http//www.w3.org/TR/CSS21/selector.html#attribute-selectors for more on those.

Anyways, IE's support of those is poor (or not at all really). However more standards compliant browsers (Netscape, Firefox, Opera ...) make use of them.

Since IE embeds the font and uses it you don't have to worry about it. It's the other browsers that you're having trouble with.

If you put this code into a CSS test file

h1{ font-size 12px; font-family Verdana; }
h1[title~="Anything"] { font-size 30px; font-family monospace; color blue; }

And in a test HTML file you had

<h1 title="Anything">Heading</h1>

You'd see that IE shows the h1 at 12px in the font Verdana. Those other more standard compliant browser will show the h1 in blue at 30px with a font-family of monospace.

Not a perfect solution to your problems, but it's a step in the right direction...

Last seen: 18 years 27 weeks ago
Joined: 2004-07-22
Posts: 7
Points: 0

Font size depending on font family

I'm sure javascript can do something to help you out.

roytheboy's picture
North Wales, UK
Last seen: 9 years 27 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

Font size depending on font family

Ankou wrote:
You could rely on the attribute selectors. Have a look at http://www.w3.org/TR/CSS21/selector.html#attribute-selectors for more on those.

Wow - you learn something every day Smile

Life's a b*tch and then you die!