HighDots Forums  

font default

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss font default in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roedy Green
 
Posts: n/a

Default font default - 08-02-2008 , 11:29 AM






Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Reply With Quote
  #2  
Old   
Sherman Pendley
 
Posts: n/a

Default Re: font default - 08-02-2008 , 01:40 PM






Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Quote:
Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?
Just apply it to the top-level body rule:

body { font: 1em serif }

Elements nested in the body element will inherit its styles - that's
the C (for Cascade) in CSS.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: font default - 08-02-2008 , 02:30 PM



Scripsit Sherman Pendley:

Quote:
Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?

Just apply it to the top-level body rule:

body { font: 1em serif }
The question presumably refers to browser default font family. What
makes you think it is a serif font and that it is the font corresponding
to the keyword serif? Hint: You have no grounds for that,

Quote:
Elements nested in the body element will inherit its styles - that's
the C (for Cascade) in CSS.
You don't understand the "C" in "CSS". Neither do most other authors,
but this is a good reason to refrain from giving advice on CSS in public
before you have a clue.

Look at the rendering of an <input> element for example.

The correct answer is that the "best" one can do is
* { font-family: inherit !important; }
but this
a) isn't supported by IE
b) is ineffective against style sheets that use the !important weapon
too.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #4  
Old   
Sherman Pendley
 
Posts: n/a

Default Re: font default - 08-02-2008 , 02:42 PM



"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> writes:

Quote:
Scripsit Sherman Pendley:

Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?

Just apply it to the top-level body rule:

body { font: 1em serif }

The question presumably refers to browser default font family. What
makes you think it is a serif font and that it is the font
corresponding to the keyword serif? Hint: You have no grounds for
that,
I think no such thing. Hint: You have no grounds for believing
yourself to be psychic.

Quote:
Elements nested in the body element will inherit its styles - that's
the C (for Cascade) in CSS.

You don't understand the "C" in "CSS". Neither do most other authors,
but this is a good reason to refrain from giving advice on CSS in
public before you have a clue.
You don't understand basic manners. This is a good reason to refrain
from speaking to others before you have a clue.

Quote:
The correct answer is that the "best" one can do is
* { font-family: inherit !important; }
but this
a) isn't supported by IE
b) is ineffective against style sheets that use the !important weapon
too.
So, your "correct answer" is one that doesn't work for 70-80% of the
real users who will visit a site? Typical ivory-tower bullshit - and
precisely what I've come to expect from you.

*plonk*

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply With Quote
  #5  
Old   
Roedy Green
 
Posts: n/a

Default Re: font default(s) - 08-02-2008 , 03:37 PM



On Sat, 02 Aug 2008 13:40:16 -0400, Sherman Pendley
<spamtrap (AT) dot-app (DOT) org> wrote, quoted or indirectly quoted someone who
said :

Quote:
body { font: 1em serif }
Thanks for your speedy response. I realise now that I do that
already. Here is a related question, which is the one I should have
asked in the first place.

What if you have 3 basic font-family patterns on your website? e.g.

for body text
font-family: "Tiresias PCfont Z","Tiresias
PCfont",TiresiasScreenfont,"Palatino Linotype","Bookman Old
Style","Book Antiqua","Trebuchet MS","Lucida Sans","Lucida Sans
Unicode",Verdana,serif;

for title-like elements:
font-family: Calibri,"Bitstream Vera Sans","Segoe
UI",Arial,Helvetica,sans-serif;

for monospaced elements:
font-family: "Bitstream Vera Sans Mono","Lucida
Console","Lucida Sans","Lucida Sans Unicode","Courier","Courier
New","Bitstream Vera Sans","Segoe UI",Arial,monospace;

Is there a way to specfy each pattern only once, then just indicate
which pattern applies to any given style?

If not, is there a way to specify the preferred font-family set you
would like to use for logical fonts monospace , sans-serif and serif?

If not, is there any way to create user-defined inheritance hierarchy
using category names rather than repeating use of tag names on
multiple style definitions or are you stuck with mirroring the HTML
tag structure?

I heard CSS was developing constants/variables, that might be useful
to solve such a problem. How is that coming along?
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Reply With Quote
  #6  
Old   
Sherman Pendley
 
Posts: n/a

Default Re: font default(s) - 08-02-2008 , 05:01 PM



Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Quote:
On Sat, 02 Aug 2008 13:40:16 -0400, Sherman Pendley
spamtrap (AT) dot-app (DOT) org> wrote, quoted or indirectly quoted someone who
said :

body { font: 1em serif }

Thanks for your speedy response. I realise now that I do that
already. Here is a related question, which is the one I should have
asked in the first place.

What if you have 3 basic font-family patterns on your website? e.g.

for body text
font-family: "Tiresias PCfont Z","Tiresias
PCfont",TiresiasScreenfont,"Palatino Linotype","Bookman Old
Style","Book Antiqua","Trebuchet MS","Lucida Sans","Lucida Sans
Unicode",Verdana,serif;

for title-like elements:
font-family: Calibri,"Bitstream Vera Sans","Segoe
UI",Arial,Helvetica,sans-serif;

for monospaced elements:
font-family: "Bitstream Vera Sans Mono","Lucida
Console","Lucida Sans","Lucida Sans Unicode","Courier","Courier
New","Bitstream Vera Sans","Segoe UI",Arial,monospace;

Is there a way to specfy each pattern only once, then just indicate
which pattern applies to any given style?
No, unfortunately CSS has no means of defining macros, constants, or
other such things. :-(

What I would do is define a selector that lists a number of element
names, as well as a class, for each of the above patterns:

P,DIV,.body { font-family: ... }
H1,H2,H3,H4,H5,H6,.title { font-family: ... }
PRE,.monospace { font-family: ... }

Then, if you needed a H5 to look like body text, you could mark it up
with a class attribute:

<h5 class="body">Fee fie fo fum.</h5>

This works because a class selector has a higher specificity than an
element name. For the above element, the first rule matches the class,
so it has a specificity value of 10, where the second only matches the
element name, so it has a value of 1. So, the first rule "wins".

<http://www.w3.org/TR/REC-CSS2/cascade.html#specificity>

You can supply more than one class for a given element. So, let's
define a class "callout" that floats a DIV to the right:

DIV.callout { float:right }

If you want a particular callout div to use monospaced text, you could
give it both class names, separated by spaces:

<div class="monospace callout">...</div>

The "multiple classes" is what allows you to do what I think you want
to do, to define rules that define a font-family, and apply those
rules in addition to rules that define other style properties.

Note also that, because the rules that define your font-families
include selectors based on element names, you'd only need to add a
class attribute to elements for which you wanted to override the
"default" font-family for their type.

Quote:
I heard CSS was developing constants/variables, that might be useful
to solve such a problem. How is that coming along?
Dave Hyatt has written a proposal, and given his position on the
Safari dev team, I'd expect it to be implemented in KHTML/Safari soon,
if it hasn't been already:

<http://disruptive-innovations.com/zoo/cssvariables/>

I've no idea when (or if) other browsers will implement his proposal.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply With Quote
  #7  
Old   
Roedy Green
 
Posts: n/a

Default Re: font default(s) - 08-02-2008 , 05:41 PM



On Sat, 02 Aug 2008 17:01:04 -0400, Sherman Pendley
<spamtrap (AT) dot-app (DOT) org> wrote, quoted or indirectly quoted someone who
said :

Quote:
No, unfortunately CSS has no means of defining macros, constants, or
other such things. :-(
hmm. If I used three different style sheets could I set up different
body defaults for the three sheets in some way what would then provide
the base for inheritance of the styles defined in that sheet?

Or all the three sheets logically one big one?
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Reply With Quote
  #8  
Old   
dorayme
 
Posts: n/a

Default Re: font default - 08-02-2008 , 06:24 PM



In article <6J1lk.43877$_03.7122 (AT) reader1 (DOT) news.saunalahti.fi>,
"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote:

Quote:
Scripsit Sherman Pendley:

Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Is there a shortcut way to define the default font family (and
characteristics) to be applied to all styles?

Just apply it to the top-level body rule:

body { font: 1em serif }

The question presumably refers to browser default font family. What
makes you think it is a serif font and that it is the font corresponding
to the keyword serif? Hint: You have no grounds for that,
It would be a funny question if it did refer to browser default font
family considering one does not need to specify anything to let the
default call the tune. Hint: that's what default means.

Korpela misses that Sherm's is merely an example and might be changed to
suit real circumstances.

--
dorayme


Reply With Quote
  #9  
Old   
dorayme
 
Posts: n/a

Default Re: font default - 08-02-2008 , 06:27 PM



In article <m14p63z2ad.fsf (AT) dot-app (DOT) org>,
Sherman Pendley <spamtrap (AT) dot-app (DOT) org> wrote:

Quote:
"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> writes:

Scripsit Sherman Pendley:

precisely what I've come to expect from you.

*plonk*

sherm--
I am sure you plonked him a while back. Are you a bit of a softie Sherm
with a time lock on your killfile?

--
dorayme


Reply With Quote
  #10  
Old   
Sherman Pendley
 
Posts: n/a

Default Re: font default(s) - 08-02-2008 , 06:36 PM



Roedy Green <see_website (AT) mindprod (DOT) com.invalid> writes:

Quote:
On Sat, 02 Aug 2008 17:01:04 -0400, Sherman Pendley
spamtrap (AT) dot-app (DOT) org> wrote, quoted or indirectly quoted someone who
said :

No, unfortunately CSS has no means of defining macros, constants, or
other such things. :-(

hmm. If I used three different style sheets could I set up different
body defaults for the three sheets in some way what would then provide
the base for inheritance of the styles defined in that sheet?
I'm not sure just what you're asking. Stylesheets don't inherit, all
they do is define which elements a set of style properties are applied
to. The effect of those properties is subject to inheritance, but the
selection of what elements the properties will be applied to is not.

Inheritance comes into play when a browser needs to decide how to
render an element to which no explicit style has been applied; in that
case, the browser looks to the element's parent, grandparent, etc. to
find the value the child should inherit for that property. At that
point, it's irrelevant which (if any) stylesheet was used to apply
the property to the ancestor element; it's the property value that's
inherited, not the rule that was used to apply it.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.