Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 10:25 PM
Iain Hallam
Guest
 
Posts: n/a
Default Collapsing <p> spacing in a table in Firebird

Hi.

I'm displaying some stats in a table and I'd been putting the text into
a <p> tag inside the <td>s:

<td>
<p>Note 1: See column x for foo...</p>
<p>Note 2: See page <a ...>17</a> for bar</p>
</td>

When the page is viewed in Internet Explorer, the space between the
paragraphs is maintained, but the space above and below the paragraphs
is dispensed with:

+-------------------------------------------+
| Note 1: See column x for foo... |
| |
| Note 2: See page <a ...>17</a> for bar... |
+-------------------------------------------+

Mozilla (Firebird 0.7), on the other hand, renders all the space:

+-------------------------------------------+
| |
| Note 1: See column x for foo... |
| |
| Note 2: See page <a ...>17</a> for bar... |
| |
+-------------------------------------------+

Presumably this is correct behaviour according to the specs, but what
CSS would I have to add to get Mozilla to render more like IE? I'm
curently manually putting "margin-top: 0px;" on the first and
"margin-bottom: 0px;" on the second!

Any help would be greatly appreciated.

- Iain.
  #2  
Old July 20th, 2005, 10:25 PM
Brian
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Iain Hallam wrote:[color=blue]
>
> I'm displaying some stats in a table and I'd been putting the text into
> a <p> tag inside the <td>s:
>
> <td>
> <p>Note 1: See column x for foo...</p>
> <p>Note 2: See page <a ...>17</a> for bar</p>
> </td>
>
> Mozilla (Firebird 0.7), on the other hand, renders all the space
>
> what CSS would I have to add to get Mozilla to render more like IE?[/color]

td p {margin-bottom:0;}
td p:first-child {margin-top:0; margin-bottom: 1em}

adjust to taste. NB: MSIE/Win cannot parse first-child.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

  #3  
Old July 20th, 2005, 10:25 PM
Iain Hallam
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Brian wrote:[color=blue]
> Iain Hallam wrote:
>[color=green]
>>
>> I'm displaying some stats in a table and I'd been putting the text
>> into a <p> tag inside the <td>s:
>>
>> <td>
>> <p>Note 1: See column x for foo...</p>
>> <p>Note 2: See page <a ...>17</a> for bar</p>
>> </td>[/color][/color]
[color=blue]
> td p {margin-bottom:0;}
> td p:first-child {margin-top:0; margin-bottom: 1em}
>
> adjust to taste. NB: MSIE/Win cannot parse first-child.[/color]

Thanks. Is there a :last-child if I need to include 3 or more paras?

+---------------------------------------------+
| Note 1: See column x for foo... |
| |
| Note 2: See page <a ...>17</a> for bar... |
| |
| Note 3: See site <a ...>x</a> for foobar... |
+---------------------------------------------+

- Iain.
  #4  
Old July 20th, 2005, 10:25 PM
Anne van Kesteren
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Iain Hallam wrote:[color=blue]
> Thanks. Is there a :last-child if I need to include 3 or more paras?[/color]

Yes (CSS3 and supported by some browser), but why would you need it here?


--
Anne van Kesteren
<http://www.annevankesteren.nl/>
  #5  
Old July 20th, 2005, 10:25 PM
Brian
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Iain Hallam wrote:[color=blue]
>
> Thanks. Is there a :last-child if I need to include 3 or more paras?[/color]

Not yet. It's proposed in CSS3. (Mozilla and possibly Opera offer
support for a few parts of CSS3. I don't think last-child is one of them.)

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

  #6  
Old July 20th, 2005, 10:25 PM
Anne van Kesteren
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Brian wrote:[color=blue]
> Iain Hallam wrote:
>[color=green]
>>
>> Thanks. Is there a :last-child if I need to include 3 or more paras?[/color]
>
>
> Not yet. It's proposed in CSS3. (Mozilla and possibly Opera offer
> support for a few parts of CSS3. I don't think last-child is one of them.)
>[/color]

Mozilla supports ':last-child':
<http://bugzilla.mozilla.org/show_bug.cgi?id=46916>


--
Anne van Kesteren
<http://www.annevankesteren.nl/>
  #7  
Old July 20th, 2005, 10:25 PM
Brian
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Anne van Kesteren wrote:[color=blue]
> Brian wrote:
>[color=green]
>> Not yet. It's proposed in CSS3. (Mozilla and possibly Opera offer
>> support for a few parts of CSS3. I don't think last-child is one
>> of them.)[/color]
>
> Mozilla supports ':last-child':[/color]

Good to know. Thanks for the correction. (And sorry for bad info.)

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

  #8  
Old July 20th, 2005, 10:26 PM
Iain Hallam
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Anne van Kesteren wrote:[color=blue]
> Iain Hallam wrote:[color=green]
>> Thanks. Is there a :last-child if I need to include 3 or more paras?[/color]
> Yes (CSS3 and supported by some browser), but why would you need it here?[/color]

Good point :-) Umm, "it was a late-night posting"? (Well... no, it
wasn't but I can't have been thinking straight!)

div p {margin-bottom: 0;}
div p:first-child {margin-top: 0;}

seems to work quite nicely in Mozilla Firebird, but IE 6 seems to be
ignoring the :first-child selector and puts a margin above each first
paragraph. Also, the site I'm developing (sample page at
www.bristol-digital.com) has the main content area go white in IE
6.0.2800.1106 (SP1). Is this a problem with my CSS?

- Iain.
  #9  
Old July 20th, 2005, 10:26 PM
Brian
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Iain Hallam wrote:[color=blue]
> IE 6 seems to be ignoring the :first-child selector[/color]

Yes, IE/Win can not parse :first-child
Just one of its many css deficiencies.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

  #10  
Old July 20th, 2005, 10:31 PM
Barry Pearson
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Iain Hallam wrote:[color=blue]
> Hi.
>
> I'm displaying some stats in a table and I'd been putting the text
> into a <p> tag inside the <td>s:[/color]
[snip]

I can't tell whether you got a response. What I use in all my CSSs is:

td > h1:first-child, td > h2:first-child, td > h3:first-child, td >
h4:first-child, td > p:first-child { margin-top: 0; } /* Firebird */

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/


  #11  
Old July 20th, 2005, 10:32 PM
Nicolai P. Zwar
Guest
 
Posts: n/a
Default Re: Collapsing <p> spacing in a table in Firebird

Barry Pearson schrieb:
[color=blue]
> Iain Hallam wrote:
>[color=green]
>>Hi.
>>
>>I'm displaying some stats in a table and I'd been putting the text
>>into a <p> tag inside the <td>s:[/color]
>
> [snip]
>
> I can't tell whether you got a response. What I use in all my CSSs is:
>
> td > h1:first-child, td > h2:first-child, td > h3:first-child, td >
> h4:first-child, td > p:first-child { margin-top: 0; } /* Firebird */
>[/color]


--
Nicolai Zwar -- http://www.nicolaizwar.com

"I don't post off-topic digests. I consistently ask the antagonists
what their postings have to do with classical music, which happens to be
the topic of this newsgroup."
(Dr. David J. Tholen, Astronomer, in his "Antagonists Digest, Volume
2452972, posted in rec.music.classical)

 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles