HighDots Forums  

font attributes inheritance question

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


Discuss font attributes inheritance question in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Haines Brown
 
Posts: n/a

Default font attributes inheritance question - 11-12-2003 , 12:52 PM






I don't understand the inheritance logic in this situation.
Let me describe a simple situation: I have a document with a style
sheet that specifies:

address, blockquote, caption, center, dd, dir, div, dl, dt,
form, hr, menu, ol, p, td, th, ul {
font-size: 100%;
}
body {
font: 100% serif, "Times New Roman","Times Roman";
...
}
.title {
font-style: italic;
}

In the body, I have this:

<h2>Some text<span class="title">A title</span>...

The "A title" text is sanserif and larger than "Some test". Why?

--
Haines Brown
brownh (AT) hartford-hwp (DOT) com
kb1grm (AT) arrl (DOT) net
www.hartford-hwp.com


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

Default Re: font attributes inheritance question - 11-12-2003 , 01:46 PM






Haines Brown <brownh (AT) teufel (DOT) hartford-hwp.com> wrote:

Quote:
I don't understand the inheritance logic in this situation.
First, please note that in CSS we have properties. Many of them
correspond to HTML attributes, but they are still separate concepts.
(Unfortunately Microsoft calls CSS properties "attributes" in IE
documentation.)

Second, the main source of confusion is that people miss this
principle: inheritance always comes last, no matter what. _Any_ setting
of a property for an element implies that the element never inherits
that property.

Quote:
address, blockquote, caption, center, dd, dir, div, dl, dt,
form, hr, menu, ol, p, td, th, ul {
font-size: 100%;
}
That's formally correct, but rather pointless and might in vain defeat
a user style sheet setting (which e.g. tries to make captions appear in
larger font or address elements in smaller font).

Quote:
body {
font: 100% serif, "Times New Roman","Times Roman";
...
}
Rather pointless too. Any conforming implementation needs to have a
generic serif font if it uses different fonts at all, so anything you
list after serif is irrelevant.

Quote:
.title {
font-style: italic;
}
OK, but are you sure a class is best markup? It sounds you might need
the cite element.

Quote:
In the body, I have this:

h2>Some text<span class="title">A title</span>...

The "A title" text is sanserif and larger than "Some test". Why?
It's either a browser bug, or something in your markup or style sheet
that causes that. You need to specify the URL and the browser(s) used
for an analysis.

Given the extracts of HTML and CSS posted, and assuming that there
is no other style sheet in action and the h2 element is a child of
body, the span element inherits font-family and font-size from h2,
which inherits them from body. In practice, there's most probably at
least a browser default style sheet participating in the game,
assigning some font-size property at least to h2, so this value is used
instead of inheriting a value from body.

But I'm about 100% sure there's something involved that was not
disclosed.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
  #3  
Old   
Haines Brown
 
Posts: n/a

Default Re: font attributes inheritance question (resolved) - 11-13-2003 , 08:26 AM



When exploring this issue, I found that I had a problem with my
browser. I apologize for the misdirection.
--
Haines Brown
brownh (AT) hartford-hwp (DOT) com
kb1grm (AT) arrl (DOT) net
www.hartford-hwp.com


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 - 2008, Jelsoft Enterprises Ltd.