This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > August 2004 > Question: Shorthand" CSS code?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Question: Shorthand" CSS code?
|
|
|
| Occasionally, I've seen people write CSS code in shorthand for specifying
font styles. I don't exactly remember how it goes, but sometimes I see
things like this:
SPAN {font: arial, helvetica 11 bold}...
I think this is a great idea, and I'd like to do some fine tuning of my own
code. Does anybody know where I can get an explanation of how this coding
strategy works? What about for multiple font names?
Any information is appreciated. Thanks!
--
============================
- Dave
http://members.cox.net/grundage/
| |
| David Dorward 2004-08-22, 7:17 pm |
| Dave wrote:
> Occasionally, I've seen people write CSS code in shorthand for specifying
> font styles. I don't exactly remember how it goes
So rtfm: http://www.w3.org/TR/CSS2/fonts.html#font-shorthand
> SPAN {font: arial, helvetica 11 bold}...
11 what? A unit is required, but no unit that could go there could be a good
choice.
> I think this is a great idea
It isn't that great - it means you have to remember things such as which
properties must be specified when you use the shorthand. It makes it easier
to introduce errors and harder to maintain.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
| |
|
| On Sun, 22 Aug 2004 11:40:22 -0500, Dave <dave@yahoo.com> wrote:
> Occasionally, I've seen people write CSS code in shorthand for specifying
> font styles. I don't exactly remember how it goes, but sometimes I see
> things like this:
>
> SPAN {font: arial, helvetica 11 bold}...
>
> I think this is a great idea, and I'd like to do some fine tuning of my
> own
> code. Does anybody know where I can get an explanation of how this coding
> strategy works? What about for multiple font names?
>
> Any information is appreciated. Thanks!
>
See http://www.w3.org/TR/CSS2/propidx.html for all CSS2 properties. You'll
find a number of shorthand possibilities, including font.
However, your above rule is flawed. Font-family comes last, and 11 has no
unit. It's not required, but advisable, to end your font family with a
generic.
span {font: bold 110% Arial, Helvetica, sans-serif}
Is it better? If you use the font shorthand all 5 the font-weight,
font-style, font-size and font-family are reset to their normal values
before the changes you make are set. So if you don't state all of these
values, you might expect a font-weight: bold to be inherited but it won't
be.
Like all shorthand styles, there are times it's the right tool for the
job, and times it's not.
| |
|
| Wouldn't the Arial, Helvetica, Sans-Serif be surrounded in quotes?
--
============================
- Dave
http://members.cox.net/grundage/
"Neal" <neal413@yahoo.com> wrote in message
news:opsc5awty06v6656@news.individual.net...
> On Sun, 22 Aug 2004 11:40:22 -0500, Dave <dave@yahoo.com> wrote:
>
specifying[color=darkred]
coding[color=darkred]
>
>
> See http://www.w3.org/TR/CSS2/propidx.html for all CSS2 properties. You'll
> find a number of shorthand possibilities, including font.
>
> However, your above rule is flawed. Font-family comes last, and 11 has no
> unit. It's not required, but advisable, to end your font family with a
> generic.
>
> span {font: bold 110% Arial, Helvetica, sans-serif}
>
> Is it better? If you use the font shorthand all 5 the font-weight,
> font-style, font-size and font-family are reset to their normal values
> before the changes you make are set. So if you don't state all of these
> values, you might expect a font-weight: bold to be inherited but it won't
> be.
>
> Like all shorthand styles, there are times it's the right tool for the
> job, and times it's not.
| |
| Jukka K. Korpela 2004-08-22, 7:17 pm |
| "Dave" <dave@yahoo.com> wrote:
> Wouldn't the Arial, Helvetica, Sans-Serif be surrounded in quotes?
Maybe in your code. But your posting style (upside-down fullquoting, and
a few other signals) suggests that you are not looking for constructive
comments. Anyway, here's one: quoting Sans-Serif would make sense only if
there were a font with the proper name "Sans-Serif". Of course, anyone
and his brother could design such a font (though hopefully couldn't
trademark it), but they haven't, so far.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
| |
|
|
|
| On Sun, 22 Aug 2004 13:39:06 -0500, Dave <dave@yahoo.com> wrote:
> Wouldn't the Arial, Helvetica, Sans-Serif be surrounded in quotes?
>
Please don't reply on top, and especially don't put quoted material in the
signature (under the --).
Quotes are only used to surround font names with spaces like "Times New
Roman" or "Arial BT". And by the way, I don't know for sure whether
Sans-Serif is incorrect, but the "proper" form is sans-serif. Remember,
it's not a name of a font. It's a generic font that cues the UA to use
whatever is the generic sans-serif font to render the text. For most UAs
this is Arial or Helvetica anyway, but it could be anything.
| |
| Harlan Messinger 2004-08-23, 7:19 pm |
| "Dave" <dave@yahoo.com> wrote:
>Wouldn't the Arial, Helvetica, Sans-Serif be surrounded in quotes?
Only if "Arial, Helvetica, Sans-Serif" is the name of a single font
family.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
| |
|
| On Sun, 22 Aug 2004 13:39:06 -0500, Dave <dave@yahoo.com> wrote:
> Wouldn't the Arial, Helvetica, Sans-Serif be surrounded in quotes?
>
Please don't reply on top, and especially don't put quoted material in the
signature (under the --).
Quotes are only used to surround font names with spaces like "Times New
Roman" or "Arial BT". And by the way, I don't know for sure whether
Sans-Serif is incorrect, but the "proper" form is sans-serif. Remember,
it's not a name of a font. It's a generic font that cues the UA to use
whatever is the generic sans-serif font to render the text. For most UAs
this is Arial or Helvetica anyway, but it could be anything.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|