Andy Dingley wrote:
Quote:
On 13 Sep, 17:00, shapper <mdmo...@gmail.comwrote:
Quote:
>I have something has follows:
[...]
Quote:
Quote:
>My document font size is 1em.
>>
>My div font size is 1.4em.
Sounds ominous, doesn't it?
Quote:
Try to avoid setting these very "broad" selectors such as
div { ... }
because (as you've noticed) this will affect _every_ <div>
Indeed. Besides, when there is a <tableinside a <div>, the font-size
property will be inherited into the table, unless some style sheet sets
font-size for the <tableelement or its descendants.
Quote:
The way CSS selectors work it's easy to "switch them on" for very
narrow scope, but hard to "switch them off" when you don't want them
to apply.
Right. In the general case, once you have set a property e.g. for a <div>
element, there is no way to say, at a later stage, "ignore that setting" or
"act as if I did not set that" or "use whatever defaults you would have
used". In the case of font-size, though, we can be relatively sure that
div { font-size: 100%; }
has such an effect, though of course a misguided user's style sheet _could_
set font-size for <divand we would then brutally override it.
Quote:
Quite possibly you really needed some markup like this:
>
<div class="loud-and-shouty" >Really Important Stuff!!!</div>
[...]
Quote:
Where the CSS
>
.loud-and-shouty { font-size: 1.4em; }
>
would do what you _needed_, without the side-effect of changing the
behaviour for your <tableinside another anonymous <div>
Logically, in that case, you should probably use
<div class="important"><strong>Really Important Stuff!!!</strong></div>
with
..important { font-size: 1.4em; font-weight: normal; }
(The latter declaration is there to prevent the default bolding of <strong>
in graphic presentation.)
With just <divmarkup, you are not saying anything semantically, and the
text will not be emphatic at all when CSS is off.
Quote:
Quote:
>What should be the font-size in my table to get back to the 1em of
>the document?
>
In that case, divide one by the other: 0.7em
No, it's not exact then, since 1.4 times 0.7 is 0.98, not 1. Using 0.714em
would probably be exact enough. But as you wrote, it's better to avoid
creating the problem.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/