Firefox bug in CSS (font) shorthand

This is a discussion on "Firefox bug in CSS (font) shorthand" within the Web Page Design section. This forum, and the thread "Firefox bug in CSS (font) shorthand are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 10th, 2007, 03:49
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Firefox bug in CSS (font) shorthand

I've been fighting this bug all day and finally got to the bottom of it. Thought I'd post it here in case it helps anyone...

When using font shorthand...
Code: Select all
font:bold 1em/1.2em georgia,"times new roman",serif;
or
font:italic 600 small-caps 1.2em/1.8em verdana, arial, helvetica, sans-serif;
if you include a line-height value, most of the other declarations will be ignored. As soon as I remove the line-height, it works fine.

I've tested this pretty thoroughly in FF 2.0.0.3 (and searched extensively for it on the web.) My searches didn't turned up anything. I'm surprised that no one else has encountered this. Maybe it used to work (prior to 2.0.0.3)? Anyway, hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 10th, 2007, 13:38
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Does this work?

Code: Select all
font: italic small-caps bold 1.2em/1.8em verdana,arial,helvetica,sans-serif;
You're switched the correct order for the font-variant and font-weight. Also, I don't believe any browser supports the weight variants, so you might as well just use "bold" instead of 600.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 10th, 2007, 13:46
Most Reputable Member
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

With a lot of shorthand though the order can be switched around. You've just got to switch it around in the right way I guess.

Pete.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 11th, 2007, 06:47
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Things can be switched to an extent, but it's not CSS that allows this, it's the browsers. Sticking to the standards is the only way to ensure x-browser compatibility.

Code: Select all
background: url(image.jpg) top left no-repeat;
The above snippet caused problems in Safari 1. While it's wrong, it still seems to be the most popular arrangement of the values. Point in case, make sure the order is right! An extra 10 seconds to reference it could save a lot of hassle.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 11th, 2007, 17:13
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

I've actually had the order right in some of my trials and it still didn't work. In fact, even this doesn't seem to work:
Code: Select all
font: bold 0.9em;
I know that should work, so I'm left wondering what the heck is going on. I think I've got some weird problem in my stylesheet.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 11th, 2007, 17:17
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Quote:
Originally Posted by Ryan Fait View Post
I don't believe any browser supports the weight variants, so you might as well just use "bold" instead of 600.
I routinely test in FF2 and IE5.5 during development, then check everything with browsercam before publishing publicly. So far, I've not had any problems using weight values in either FF or IE. I haven't done a browsercam check yet, though, so I suppose it could all fall apart in Opera or Safari or Camino or something.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 11th, 2007, 17:23
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Some shorthand properties have values that are required at all times when using them and font is one of them

Efficient CSS with shorthand properties

Quote:
When using the font shorthand you can omit any values except font-size and font-family – you always need to give values for those, and in that order.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 11th, 2007, 17:54
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Quote:
Originally Posted by karinne View Post
you can omit any values except font-size and font-family
What a terrible rule! Kind of defeats the whole purpose! In the majority of my pages, I use the exact same font family throughout and declare it in the body selector! No wonder I'm having so many problems! If I have to declare the family every time I use font shorthand, I'm not saving much in the way of code or keystrokes! I think I won't be bothering with font shorthand in the future!

Sorry, Karinne - please don't take that as shooting the messenger - I appreciate the help and the clarification, but I have to wonder what genius made that rule?!

I find it amusing that IE supports font shorthand even without the font family declaration. As much as IE gets bashed (and I do so as often as anyone), how ironic that their non-compliance turns out to be a superior method!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 11th, 2007, 18:01
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Well ... the thing is ... you should rarely use the font property. You should set it once in your body then when you change the site just use the font-size or to change the weight (boldness) use font-weight
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Apr 11th, 2007, 18:45
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 245
Thanks: 6
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

Yup. That's what I'll do. It would just be nice, when I need to change more than one font property for a given element (which is fairly common), to be able to do it simply/quickly/easily with shorthand - without having to declare the font family.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Apr 11th, 2007, 20:03
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Firefox bug in CSS (font) shorthand

What I mean by the font-weight thing is that font-weight: 500, 600, 700, 800 and 900 will produce the same thing as font-weight: bold; and font-weight: 100, 200, 300 and 400 will produce the same thing as font-weight: normal;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
bug, css, firefox, shorthand

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is this font? Graisbeck Graphics and 3D 2 Feb 19th, 2008 15:07
Font Help lisafelst12 Graphics and 3D 25 Nov 19th, 2007 22:43
my font changes monstermunch Starting Out 1 Apr 17th, 2007 09:12
font in css zubby Web Page Design 6 Apr 14th, 2007 00:37
font help makemesick Web Page Design 3 May 6th, 2005 22:47


All times are GMT. The time now is 18:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42