473,394 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

font attributes inheritance question

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
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #1
2 1928
Haines Brown <br****@teufel.hartford-hwp.com> wrote:
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.
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).
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.
.title {
font-style: italic;
}
OK, but are you sure a class is best markup? It sounds you might need
the cite element.
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/
Jul 20 '05 #2
When exploring this issue, I found that I had a problem with my
browser. I apologize for the misdirection.
--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
7
by: Fabian Neumann | last post by:
Hi! I got a problem with font-family inheritance. Let's say I have CSS definitions like: p { font:normal 10pt Verdana; } strong { font:normal 14pt inherit;
14
by: Viken Karaguesian | last post by:
Hello all, It stinks being a newbie! One thing that I'm not sure about with CSS is: where is the "proper" place to put font attibutes? This has me a little confused. Take the below style sheet...
9
by: Dr John Stockton | last post by:
Assuming default set-ups and considering all reasonable browsers, whatever that may mean, what should an author expect that his readers in general will see (with visual browsers) for a page with...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
30
by: Takehiko Abe | last post by:
I have a <pelement with <ttinside: ;;; <p>A paragraph contains <tt>tt element</tt>.</p> I would like to set the font-size of the TT to the same as the containing <p>. This does not seem to...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
3
by: redslider | last post by:
now for my dumb-question (i note the other forum on 'inheritance' is closed): my question is about inheriting text properties, and specifically, if font-family values can be cumulatively...
14
by: Roedy Green | last post by:
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.