Forum Moderators: not2easy

Message Too Old, No Replies

P tags Inside TD Tags Go Big In IE7

Bug In My Code or In MS's....?

         

trillianjedi

6:39 pm on Aug 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This has got me beat. It renders fine in FireFox (as you'd expect). IE7 seems to make the text in all table rows big. Like way big (about 2.0em).

The W3C validator is happy (I checked that as I wasn't sure if I was allowed to use P tags inside TD's).

HTML example:-


<table>
<tbody>
<tr>
<td class="reviewtop">
<p class="title">
<a href="http://www.example.com/review1.html">Shiny Widget</a>
</p>
<p class="reviewer">
Reviewed by <i>trillianjedi</i> on 27th November 2005
</p>
</td>

CSS code:-


p.title {font-size: 1.3em; padding-bottom: 0; margin-bottom: 0;}
p.reviewer {font-size: 1.0em; padding-top: 1px; margin-top: 1px;}
td.reviewtop{border-top: 1px solid #e3e2e2;}

Any guidance gratefully received...

TJ

encyclo

10:21 pm on Aug 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm working blind here as I don't have IE7 to test. A few things to check:

- what doctype are you using?
- are you defining a default text size on the

body
or enclosing element?
- are you using IE conditional comments or other CSS hack to feed different values to IE6 (and are these rules also applied by IE7)?
- does specificity help? eg.:

td.reviewtop p.title {font-size: 1.3em; padding-bottom: 0; margin-bottom: 0;}
td.reviewtop p.reviewer {font-size: 1.0em; padding-top: 1px; margin-top: 1px;}
td.reviewtop {border-top: 1px solid #e3e2e2;}

Setek

2:10 am on Aug 7, 2006 (gmt 0)

10+ Year Member



IE doesn't inherit font-size from its parent.

I'm guessing you've set a font-size on a containing

div
, something like a "main content" sort of
div
? :)

e.g.:

div#content { font-size: 0.8em; }

But the table's fonts are all too big in IE. -If- this is the problem, it's just IE not inheriting properly. Stick in a conditional comment for IE:

div#content table { font-size: 1em; }

And it makes IE take 1em from the parent (0.8em, so 0.8em * 1em = 0.8em) and presto, it conforms :)

[edit]
Oh, I didn't read the bit about IE7. Oops :)

Umm... may I ask why design for a browser still in beta? Lets say it doesn't work now, and you find some way to hack it so it does, and then by the time the stable comes out, it's rendering it as a standard-compliant browser should, and you didn't need to do any work?

At best, the 'table not inheriting' thing is happening both in IE7 as it does in IE6, and you can just extend your conditional comment from being 5 <= x <= 6, to 5 <= x <= 7 :)

Sorry, I can't help, I haven't bothered to download IE7, and probably won't bother until it's stable :) They're still working out how to render different properties, and I don't see how it's worth it to find solutions for a constantly-changing-how-it-renders browser.
[/edit]

[edited by: Setek at 2:16 am (utc) on Aug. 7, 2006]

trillianjedi

9:31 am on Aug 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That makes perfect sense, and you're both absolutely spot on. I am defining a default text size in an enclosing DIV.

Re IE7 - ugh, sorry, my mistake, I meant IE6 (although I can report they haven't fixed this problem in IE7 either ;)).

Many thanks - that's given me enough to go fix it.

TJ

trillianjedi

10:56 am on Aug 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to add that the repair worked perfectly - many thanks!

What doctype are you using?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Although that's possibly a subject for another thread from me later. I don't know why I'm using that, and don't fully understand the difference between transitional and strict. I'll do some reading up on that - just not had time lately.

TJ

Setek

1:40 am on Aug 8, 2006 (gmt 0)

10+ Year Member



Glad to be of help :)

Quick difference between transitional and strict: transitional doctypes have certain leniencies towards your code, say maybe allowing the use of the

<font>
tag, whereas strict basically means that - knuckle down and get it right, because if you don't, you'll fail validation.

encyclo

2:01 am on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

(...) I don't know why I'm using that, and don't fully understand the difference between transitional and strict.

The doctype you have chosen is exactly the right one for when you don't really know which doctype to use. ;) It is the most flexible and easiest to design and validate against.

trillianjedi

10:40 am on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



transitional doctypes have certain leniencies towards your code, say maybe allowing the use of the <font> tag, whereas strict basically means that - knuckle down and get it right, because if you don't, you'll fail validation.

Thanks, that summarises it nicely. I'm reading up on this at the moment, I might need to start another thread on it later ;)

The doctype you have chosen is exactly the right one for when you don't really know which doctype to use.

I thought it might be! I still prefer to know why I've decided on something though, so better for me to learn why I'm using it. I may be able to use strict actually.

In my mind I suppose is a question about accessibility and doctypes - is one better than the other? Don't answer that here though - I've posted another thread [webmasterworld.com] in the HTML forum.

TJ