Forum Bugs

Bug with min-width and table-cell display

jomorris
I have the following html:

<style>
           p { display:table; }
            p span { display:table-cell; }
            p span:nth-child(1) { min-width:1.5in }
            p span:nth-child(2) { min-width:1.5in }
            p span:nth-child(3) {  }
</style>

<p>
<span>This is part 1.</span>
<span>This is part 2.</span>
<span>This is part 3.</span>
</p>


The output is not respecting the min-width values.

I have a jsfiddle that shows the results. Using Chrome, you should see the correct alignments.

https://jsfiddle.net/dxvxy9cm/
mikeday
We will investigate this issue. In the meantime, how about using the "width" property?
hallvord
Hi, thanks for reporting this issue. I've written a test case based on your code and put it on Github here: https://github.com/yeslogic/miscellaneous-testcases/blob/master/layout/min-width-on-some-table-cell-elements-001.htm
Hope you don't mind :)

From what I see, this error occurs if some but not all siblings defined as table-cell elements have min-width set. The one(s) which do NOT have a specified min-width apparently confuse Prince into ignoring the min-width on all and shrink them to fit the content instead. This looks like the wrong way to interpret that code but I'm personally not sure what the right way is. Presumably something like this:

1) If there is more space than min-width available, just divide available width equally between all table-cells (but what about cells with too much content? Widen or just grow taller?)
2) If there is not enough space so even distribution would create cells smaller than min-width, respect the min-width and reduce the width of the remaining cell instead.

Announcement: repos for tests/utils

Edited by hallvord

jomorris
We also noticed that when the width was less than 2in, it was ignored. So placing 1.5in for the min-width would be ignored, but 2in would not. Very odd.