Closed Bug 250266 Opened 20 years ago Closed 20 years ago

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

Categories

(Core :: Layout: Block and Inline, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 30802

People

(Reporter: matt, Unassigned)

References

()

Details

Attachments

(4 files)

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
Assignee: firefox → nobody
Component: General → Layout
Product: Firefox → Browser
QA Contact: firefox.general → core.layout
Version: unspecified → Trunk
Attached file testcase
WFM 20040705 PC/Win2000
Attached file reduced site testcase
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
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.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
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.
Status: RESOLVED → UNCONFIRMED
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.
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...
Status: UNCONFIRMED → NEW
Component: Layout → Layout: Tables
Ever confirmed: true
OS: Windows XP → All
QA Contact: core.layout → core.layout.tables
Hardware: PC → All
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

*** This bug has been marked as a duplicate of 30802 ***
Status: NEW → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: