6 replies [Last post]
ckbraman
Offline
Regular
New York
Last seen: 17 years 21 weeks ago
New York
Joined: 2005-11-04
Posts: 34
Points: 0

I'm a beginning css designer who has created a layout with a menu system based on an unordered list. Because the size of the fonts in this list are an integral part of the design, I sized the fonts in pixels and added the "!important" rule definition in the font-size tag. (The fonts in the body text are sized using ems as units, as their size in not integral to the design and so, in contrast to the fonts in the menu, I'd like allow them to be resized if desired by the visitor.) Strangely, though, both the fonts sized as pixels with the !important rule definition and the fonts sized as ems without the !important rule definition rescale when the font scale is changed in the user's browser settings.

Does anyone know why the !important rule is not doing its job, and have any suggestions on how I can acheive what I'm trying to do?

The page is at newyorkmultimedia.com.

Thanks very much to anyone who can help.

BonRouge
BonRouge's picture
Offline
Enthusiast
Sendai, Japan
Last seen: 14 years 27 weeks ago
Sendai, Japan
Timezone: GMT+9
Joined: 2005-07-10
Posts: 237
Points: 0

"!important" rule definition disabled

If I've understood correctly, you're checking your page in a good browser (not IE) and you're expecting font-sizes in 'px' to stay the same size when you try to resize them in the browser. Is that right? Well, it doesn't work like that. The fonts will stay the same size in IE, but good browsers allow users to increase the font-size of text even though it's been given a supposedly fixed font-size.

(I hope I understood the situation correctly)

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 4 years 21 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

"!important" rule definition disabled

Hi

Having seen your site, this is why:

Many folk avoid horizontal menu's of this number of options
Those that do have them use images with the text as images.

Trevor

ckbraman
Offline
Regular
New York
Last seen: 17 years 21 weeks ago
New York
Joined: 2005-11-04
Posts: 34
Points: 0

but...

BonRouge, ClevaTreva,

Thanks for your responses.

BonRouge,

I thought the "!important" rule is supposed to over-ride user settings in even compliant browsers. Not true?

ClevaTreva,

I realize I could use images, but I wanted to use html/css for the sake of simplicity and for search engines to be able to follow the links.

Does anyone else have any insights here, or is what I'm attempting truly a lost cause?

BonRouge
BonRouge's picture
Offline
Enthusiast
Sendai, Japan
Last seen: 14 years 27 weeks ago
Sendai, Japan
Timezone: GMT+9
Joined: 2005-07-10
Posts: 237
Points: 0

Re: but...

ckbraman wrote:

I thought the "!important" rule is supposed to over-ride user settings in even compliant browsers. Not true?

You'd think so, wouldn't you?

But... no. It will override a user style sheet, but if someone wants to increase the size of the text in the browser, they're free to do so.

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 4 years 21 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Re: but...

ckbraman wrote:
I realize I could use images, but I wanted to use html/css for the sake of simplicity and for search engines to be able to follow the links.

I think there is a way to have the text but hide it and show the image, so the search engine finds it, but the user sees the image.

Haven't done it myself. Image Text replacement or something like that.

Trevor

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 8 years 11 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

"!important" rule definition disabled

Something that has not been touched upon is the fact that really you should not be attempting this level of control, it starts to bleed into the realm of accessibility issues, it's in the user hands how they require their screen to display and they must have the option of large text size if thats what they require.

You will find that taken to literal ends one is not really meant to quote any measurements in what are deemed fixed sizes but to always use relative units.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me