Forum Moderators: not2easy

Message Too Old, No Replies

Font size inheritance

         

andreasfriedrich

11:32 pm on Dec 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a site with a three column CSS layout. Both right and left (navigation) column float right or left respectively.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<div id="nav">%%NAVIGATION%%</div>
<div id="top">
<a href="%%BASE_ADDRESS%%">
<img src="theme/img/title.png" alt="%%TITLE%%" />
</a>
</div>
<div id="right">
%%RIGHT_TEXT_SHY%%
</div>
%%MAIN_TEXT_SHY%% &nbsp;
%%FOOTNOTES%%
</div>
<div id="footerbox">
</div>
</body>
</html>

In the right column I have the following HTML code

%%RIGHT_TEXT_SHY%% = ... 
<p>happy birthday, aaron!</p>
<div class="address">
<p>Name</p>
<p>Street</p>
</div>

My stylesheet looks like this:

blockquote, h1, h2, h3, h4, h5, h6, input, li, 
p, select, td, textarea {
font-family:georgia,verdana,arial,helvetica,sans-serif;
font-size:90%;
}
#right {
float:right;
width: 27%;
}
#right p {
font-size:75%;
}
#right div.address {
margin: 8px 12px;
}
#right div.address p {
text-indent:0px;
margin: 0px;
}
#right div.address p.ort {
margin: 2px 0px 0px 0px;
}
p {
margin: 8px 12px;
line-height: 1.2em;
text-indent: 16px;
}

The strange thing is that Name and Street will be displayed in a smaller font than happy birthday, aaron both in Moz1.1 and IE6. Why?

Only if I add font-size: 100%; to the #right div.address class do I get the right result. But why do I need to do that. It was my understanding that that was the default unless any element inherited something differently from one of its ancestors. (I do realize that the last part is a redundant sentence, since that is the meaning of default.)

I did not set the font-size for any element <html><body><div id="right"><div class="address"><p> other than p. So html, body, #right, div.address all should be set to the default 100%. Then why do I need to set in explicitly. Is this just an error in the implementation or I there something Iīm missing.

Any help would be appreciated.

Andreas

SuzyUK

12:00 am on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Andreas I doubt very much if you're missing anything

but that example you provided seems to prove that inheritance is taken a little more than literally!

I can't tell from all your code but I'm thinking that the paragraph setting may have something to with it...but that is just a guess

I know it's not (always)logical, (much as we'd like it to be) but it's the only thing I can see, from the code you've provided...

but it goes to prove that no matter how much you/we may understand this CSS lark...they're always going to catch us out ;)

Suzy

andreasfriedrich

12:11 am on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Suzy.

I have been very careful to avoid any inherited font-size settings since I know these to be buggy across a lot of implementations.

Could you please explain your idea about the paragraph settings to be the cause of this behaviour. There is no more code tinkering with paragraph font-sizes.

Andreas

SuzyUK

1:23 am on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't really say Andreas, I don't understand all of your code and it's not producing the error in my browser.

ref:
<p>happy birthday, aaron!</p>
<div class="address">
<p>Name</p>
<p>Street</p>
</div>

but I'm thinking that because the div class"address" appears after the <p> tag you've applied the font-size to..that perhaps the following <p> tags are inheriting where they shouldn't..

like I say it's not logical, but without the whole page code and CSS I can't say for sure.

I've just spent the weekend getting a guestbook CSS & XHTML compliant, so at this point I'm about ready to believe anything!...tired and greyer :)

Suzy

[edit] I'm presuming you're using php or the like,
I notice you have a general setting for your <p> tag, so without knowing what <div> this falls in.. it's fairly impossible to say...

if you've a test page online can you sticky me the URL...this may help

thanks
Suzy[/edit]

SuzyUK

11:08 am on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi again..

I seem to have lost the "owner edit button" on my posts so had to reply this way again..

Andreas, it must have been late and I must have been tired ;)

I understand code now ;)

in you original post, there is a closing </div> tag that doesn't have an opening one.....and I had pasted code into f/page which auto removed it, so I didn't see it earlier

don't know if that affects anything

re: previous post just ignore it!
Suzy

Nick_W

12:13 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, <address></address> would be a better way of doing addresses ;)

Nick

andreasfriedrich

1:32 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Suzy, the missing div start tag is there in my pages. Itīs <div id="main">.

Nick, you are right, but that does not change the strange inheritance behaviour. Any ideas on that?

Andreas

Nick_W

3:08 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm... I don't see anything wrong with it, sorry...

Nick

andreasfriedrich

3:46 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks anyway.

At least I was able to increase my post count. ;)

BTW CSS sucks if you canīt get it to work for no apparent reason.

Andreas

holly

4:11 pm on Dec 8, 2002 (gmt 0)

10+ Year Member



It appears to me that your style orders and applications are making that font size 75% of 90%{and maybe more than once], which would explain the ultra small print. [by the way, just for reference, 8em or 80% on a font size of default nature is very tiny in Mac browsers set on average text size viewing, 75% may be a bit too small, unless you have a font size of larger than 1 em or 100% as the parent for that declaration]

Backtrack and evaluate each font sizing and style applied and you will see how this is happening. Remember that CSS is cascading and applies items down that list and closest to the actual content rendered. I have to look at this a bit closer, but that is what I am seeing.

You may try lifting all those combo styles out of your sheet and simplify the styles a bit. [easier to debug, less chances of items being applied twice to an element or text.]

holly

PS: (Added after post) - I noticed a TD in the styles, is this area also in a table cell by any chance? If so, TD(90% size)(P 90% size), then (address class 75%) size may be going on here, also?

g1smd

9:54 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you run the CSS through [jigsaw.w3.org...] just in case there is something that has been missed?

andreasfriedrich

10:12 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My CMS which uses the css validator to check my css files prior to uploading them did not complain about any errors.

Andreas

andreasfriedrich

10:17 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I noticed a TD in the styles, is this area also in a table cell by any chance? If so, TD(90% size)(P 90% size), then (address class 75%) size may be going on here, also?

There are no tables on the page at all.

Andreas

turk182

10:36 pm on Dec 9, 2002 (gmt 0)

10+ Year Member



<div id="right">
<p> <-- font size = 75%
happy birthday, aaron!
</p>
<div class="address">
<p> <-- maybe 90% * 75% = 67.5%?
Name
.
.
.

In the <p> of div "address" maybe there're two styles applied (90% after 75%)?

If this is true, I'd modify one of the styles