tags:

views:

77

answers:

2

Hello. I have several elements with already set fonts - like

  <div style="font-size: 10px">
    some text
    </div>

    <div style="font-size: 20p">
    some text
    </div>

I want to increment the font size proprtionally, eg

<div style="font-size: 15px">
..........................
<div style="font-size: 30px">

is that possible? div {font-size: whatever} simply overwrites the values

+3  A: 

Using relative units in font sizes will scale them relative to the font size of the parent element, but the cascade doesn't provide a way to say "relative to the font size that this overrides" (and it would usually turn into a complete mess if there was a way).

David Dorward
+1  A: 

Your question is unclear:

<div id="fred" style="font-size: 10px">hello</div>
<div id="walt" style="font-size: 20px">there</dev>

States absolute sizes which are absolute and there isn't anything that could alter those absolute measures except changing the literals. This is why many texts recommend establishing a body font and sizing relative to that:

<body style"font-size: 10px">
  <div id="joan", style="font-size: 100%">hello</div>
  <div id="mary", style="font-size: 200%">world</div>
</body>

Would make "joan" 10px and "mary" 20px. Changing the body size to 15px would make "joan" 15px and "mary" 30px.That forms an attribute "cascade". Of course all this should be done in a style block rather than in the div attributes, but it would make this answer less direct.

msw