% padding-left doesn't work on p in a table cell




Layout: Block and Inline
14 years ago
14 years ago


(Reporter: Matt Verstarete, Unassigned)



Firefox Tracking Flags

(Not tracked)




(4 attachments)



14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1

I am using the code <p style="padding-left: 15%" >to offest a paragraph but
Firefox is offseting it. The paraph is still aligned to the left. If I change
from a % value to a px value it works fine. 

Reproducible: Always
Steps to Reproduce:
1.Create a <p> tag using the style="padding-left: 15%" css command
2. View file
Actual Results:  
The <p> tag is not off set like it should be

Expected Results:  
Off set the <p> tag


14 years ago
Assignee: firefox → nobody
Component: General → Layout
Product: Firefox → Browser
QA Contact: firefox.general → core.layout
Version: unspecified → Trunk

Comment 1

14 years ago
Created attachment 152551 [details]

WFM 20040705 PC/Win2000

Comment 2

14 years ago
Created attachment 152553 [details]
reduced site testcase

Comment 3

14 years ago
Just this snippet:
<table><td><p style="padding-left: 15%">blah</p></td></table>
makes the padding not happen. Not sure why that is, and if it's a correct
interpretation of CSS (which is always dicey with tables) or not.
Summary: Firefox does not process padding-left when using a % value → % padding-left doesn't work on p in a table cell

Comment 4

14 years ago
From the CSS specification:
"If the containing block's width depends on this element, then the resulting
layout is undefined"  http://www.w3.org/TR/CSS21/box.html#padding-properties

In this case, the width of the table cell depends on the width of the paragraph.
With the percentage padding-left on the paragraph, the paragraph width depends
on the width of the table cell.  That doesn't make much sense, and so the spec
says that the the browser can do whatever it wants.

Mozilla/Firefox are obviously doing it differently to IE, but this behaviour
isn't wrong.

You (assuming this is your site) should either set the padding in px, or set the
width of the table cell explicitly.
Last Resolved: 14 years ago
Resolution: --- → INVALID

Comment 5

14 years ago
Yes, IE does display it offset. But one confuses me now is that if I set it so
the style reads "style="text-align: center"" then Firefox does center the
paragtrah in the table cell. Yes this is also my site, I just checked the CSS
file and I do explicitly define the width of that table cell using the CSS
command "width: 600px" so if I read the last entry for this possible bug then it
was up to the browser how to display the padding if the width was not specified.
Resolution: INVALID → ---
Matt, could you please attach a testcase showing the bug, then?   The "reduced
site testcase" attached here has no width specified on anything.

Comment 7

14 years ago
Created attachment 153360 [details]
Testing padding % in TD with width

I have atteched a simple table with a CSS width spefication of 600px (in the
first td tage). The <p> tag in the table has padding-left: 15% CSS command
Confirming bug based on that testcase...
Component: Layout → Layout: Tables
Ever confirmed: true
OS: Windows XP → All
QA Contact: core.layout → core.layout.tables
Hardware: PC → All

Comment 9

14 years ago
Created attachment 157508 [details]
testcase with more content showing the padding working

Comment 10

14 years ago
The block code does optimize the reflow for the text away during the resize
reflow if the content will easily fit into the table. During the unconstrained
initial reflow it does not know the width so it can't compute the percent
padding. So it needs to reflow the text during the resize. It does reflow
however if the text is long enough.  Changing component
Component: Layout: Tables → Layout: Block and Inline

Comment 11

14 years ago

*** This bug has been marked as a duplicate of 30802 ***
Last Resolved: 14 years ago14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.