HighDots Forums  

H1 heading tags Firefox vs IE

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss H1 heading tags Firefox vs IE in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MaxiWheat
 
Posts: n/a

Default H1 heading tags Firefox vs IE - 01-13-2006 , 05:05 PM






Hi,

I would like to expose a situation that I would like to have
informations about.

Let's suppose I have a table that looks like this :

<table cellspacing="0" cellpadding="0" border ="0">
<tr>
<td><h1>Heading Something</h1></td>
</tr>
</table>

In IE, the heading will be right at the top of the cell, with no space
over it, but in Firefox there will be a space between the top of the
cell and the heading itself. As I investigated, IE looks like to put no
margin when a heading is at the top of a cell, and Firefox puts it
anyways, anywhere.

Is there a way to control this behavior ? I mean, IE puts a margin at
the top of headings when they are in the body of a cell or elsewhere,
but not if the heading is at top of a cell. Sometimes it may be
useful...

Some of you would answer "yes but you can control the margin with CSS".
Yes I know and I do it, but if I say margin-top:0px; then it would
apply everywhere, even in the body of a text, what I may not want. But
as IE and Firefox don't have the same default behavior, I need
absolutely to specify a margin for my H1 headings. I there a way to do
it without using a class just for the case a heading is at top of a
table ?

Can someone help me to understand all this ?

Thank you

Philippe Meunier
Web Developer
http://www.cybergeneration.com


Reply With Quote
  #2  
Old   
David Dorward
 
Posts: n/a

Default Re: H1 heading tags Firefox vs IE - 01-13-2006 , 05:40 PM






MaxiWheat wrote:

Quote:
Let's suppose I have a table that looks like this :

table cellspacing="0" cellpadding="0" border ="0"
tr
td><h1>Heading Something</h1></td
/tr
/table
Then I said - "My my, what a horrible abuse of table markup".

Quote:
Some of you would answer "yes but you can control the margin with CSS".
Yup.

Quote:
Yes I know and I do it, but if I say margin-top:0px; then it would
apply everywhere, even in the body of a text, what I may not want.
The joy of descendent, child and class selectors.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Reply With Quote
  #3  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: H1 heading tags Firefox vs IE - 01-13-2006 , 05:49 PM



MaxiWheat wrote:

Quote:
Hi,

I would like to expose a situation that I would like to have
informations about.

Let's suppose I have a table that looks like this :

table cellspacing="0" cellpadding="0" border ="0"
tr
td><h1>Heading Something</h1></td
/tr
/table
That does not look like tabular data to me. Why the table? What is wrong
with just:
<h1>Heading Something</h1>


This site (first English page) has nested tables; I think I counted at
least eight deep! Wow. Your margin is the least of your problems!

--
-bts
-Warning: I brake for lawn deer


Reply With Quote
  #4  
Old   
Daniel Jung
 
Posts: n/a

Default Re: H1 heading tags Firefox vs IE - 01-13-2006 , 06:11 PM



MaxiWheat wrote:
Quote:
I have a table that looks like this :

table cellspacing="0" cellpadding="0" border ="0"
tr
td><h1>Heading Something</h1></td
/tr
/table

In IE, the heading will be right at the top of the cell, with no space
over it, but in Firefox there will be a space between the top of the
cell and the heading itself.
I can't reproduce that.
See http://lingo.uib.no/daniel/opera/h_in_td.jpg.
First three browser windows is your code above (added #dddddd as
background-color the TABLE). Second row is jut the heading without, no
table, added #dddddd as background-color on the tag.


Quote:
Some of you would answer "yes but you can control the margin with CSS".
Yes I know and I do it,
How? Where?

Quote:
but if I say margin-top:0px; then it would
apply everywhere, even in the body of a text, what I may not want.
table h1 { margin-top: 0 }

applies ONLY to h1 elements INSIDE tables.

table.someclassname h1 { margin-top: 0 }

applies ONLY to h1 elements INSIDE tables which are classified
with "someclassname".

Quote:
Can someone help me to understand all this ?
Can you help me to understand why you want an h1 element INSIDE a table?
It just doesn't make sense.

- Daniel



Reply With Quote
  #5  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: H1 heading tags Firefox vs IE - 01-14-2006 , 05:39 PM



"MaxiWheat" <maxiwheat (AT) gmail (DOT) com> wrote:

Quote:
td><h1>Heading Something</h1></td
You have already been told that such an approach is most probably a bad one.
I will comment on the technical side.

Quote:
In IE, the heading will be right at the top of the cell, with no space
over it, but in Firefox there will be a space between the top of the
cell and the heading itself.
Neither behavior conflicts with any specification. The IE behavior is,
somewhat astonishingly, closer to the spirit of the specifications:
neither HTML specs nor CSS specs suggest that headings should have different
margins when appearing inside a cell. Rather, the sample style sheets for
HTML in CSS specs suggest that headings have margins that do not depend on
the context. The default styling of headings has always been typographically
bad in web browsers, and the specs share the guilt with browser vendors; but
I digress.

Anyway, several block elements have different styling in many browsers when
they appear as table cell contents. Typically, there is no top margin, even
if the element otherwise has one (by browser defaults), and there might be no
bottom margin either.

Of course, this is one of the many reasons why tables should not be used for
layout: things get unnecessarily complex. Normally a table cell contains just
text, sometimes a little inline markup, and tabular data doesn't usually need
more. But if you have block elements inside a cell, it's best to set all
margins for them explicitly, e.g.
td h1 { margin: 0; }
if that's what you want.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.