Open
Bug 681050
Opened 13 years ago
Updated 2 years ago
Percentage width/height not honored on children of a -moz-box element
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
NEW
People
(Reporter: johnjbarton, Unassigned)
References
Details
Attachments
(5 files)
Instead of obeying width 100% and height 100%, an iframe in -moz-box reverts to some default width and height.
Reporter | ||
Comment 1•13 years ago
|
||
Reporter | ||
Comment 2•13 years ago
|
||
Reporter | ||
Comment 3•13 years ago
|
||
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>flexbox fails around iframe - 3 column layout</title> <meta name="copied from" content="Gwilym Johnston"> <link rel="stylesheet" href="base.css" type="text/css" media="screen"> <style type="text/css"> /* base.css inlined */ H1 { display: block; font-size: 40px; padding: 8px 0; margin: 4px 0; /* width: 50px; */ background: rgba(255, 255, 255, 0.6); } P { padding: 4px; margin: 4px; background: rgba(255, 255, 255, 0.3); } .flexbox { margin: 10px; padding: 10px; text-align: center; } #box-1 { width: 100px; height: 100px; background-color: #E8B15B; } #box-2 { width: 100px; height: 100px; background-color: #C1D652; } #box-3 { width: 100px; height: 100px; background-color: #CDFCA9; } #main { border: 8px solid #eee; } HEADER { margin: 10px; padding: 10px; border: 8px solid #eee; } FOOTER { margin: 10px; padding: 10px; border: 8px solid #eee; } /* end base.css */ .flexbox { display:-moz-box; display:-webkit-box; display: box; text-align: left; } #main, HEADER, FOOTER { min-width: 640px; /* prevents overflow */ } H1 { width: auto; } #box-1 { height: auto; min-width: 180px; /* prevents overflow */ -moz-box-orient: vertical; -webkit-box-orient: vertical; box-orient: vertical; -moz-box-ordinal-group: 2; -webkit-box-ordinal-group: 2; box-ordinal-group: 2; -moz-box-flex: 1; -webkit-box-flex: 1; box-flex: 1; } #box-2 { height: auto; width: 180px; -moz-box-orient: vertical; -webkit-box-orient: vertical; box-orient: vertical; -moz-box-ordinal-group: 3; -webkit-box-ordinal-group: 3; box-ordinal-group: 3; } #box-3 { height: auto; width: 130px; -moz-box-orient: vertical; -webkit-box-orient: vertical; box-orient: vertical; -moz-box-ordinal-group: 1; -webkit-box-ordinal-group: 1; box-ordinal-group: 1; } body { font-family: Helvetica, Arial, sans-serif; } </style> </head> <body> <header> <h1>Firefox flexbox does not play well with iframe</h1> <p>Modified copy of <a href="http://www.gwilym.com/flexbox/example-10.html">example-10</a> from <a href="http://blog.isotoma.com/2010/08/css3-flexbox/">CSS3 Flexbox</a>. The content of the center section includes an iframe</p> </header> <section id="main" class="flexbox"> <section id="box-1" class="flexbox"> <iframe style="width: 100%; height: 100%; border: 0px none;" src="http://blog.isotoma.com/2010/08/css3-flexbox/"></iframe> </section> <aside id="box-2" class="flexbox"> <h1>2 Sidebar</h1> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam </p> </aside> <nav id="box-3" class="flexbox"> <h1>3 Nav</h1> <ul> <li><a href="#nowhere" title="Lorum ipsum dolor sit amet">Lorem</a></li> <li><a href="#nowhere" title="Aliquam tincidunt mauris eu risus">Aliquam</a></li> <li><a href="#nowhere" title="Morbi in sem quis dui placerat ornare">Morbi</a></li> <li><a href="#nowhere" title="Praesent dapibus, neque id cursus faucibus">Praesent</a></li> <li><a href="#nowhere" title="Pellentesque fermentum dolor">Pellentesque</a></li> </ul> </nav> </section> <footer> <h1>Footer</h1> </footer> </body> </html>
Reporter | ||
Comment 4•13 years ago
|
||
Reporter | ||
Comment 5•13 years ago
|
||
I tried removing all of the section/footer stuff but it does not matter.
I suspect the current flexbox code just wasn't designed for dealing with % on children; the authors assumed you'd use flex, etc. The height issue is easy to work around by giving the iframe -moz-box-flex: 1. Oddly enough, using any -moz-box-align *other* than its initial value of 'stretch' works around the width issue, though it seems like a bug to me that 'stretch' doesn't shrink things while the others do.
(And that's using -moz-box-align on #box-1.)
Oh, and the other sentence I meant to write before I was interrupted while commenting here is that dholbert is working on a new implementation of the flexbox spec which will hopefully eventually replace our current one.
Reporter | ||
Comment 9•13 years ago
|
||
Thanks, the workaround in comment 6 worked. For my reference, the similar but different bug in chrome: http://code.google.com/p/chromium/issues/detail?id=93826
Updated•13 years ago
|
Summary: Firefox iframe in -moz-box gets wrong width and height → Replaced element with percentage width/height in -moz-box gets wrong width and height
Reporter | ||
Comment 10•13 years ago
|
||
Another test case that fails: http://code.google.com/p/chromium/issues/attachmentText?id=93826&aid=938260001000&name=ChromeFlexboxIFrame.html&token=3da2c9d1e0ea98accec1cbe0c712d159
Comment 11•12 years ago
|
||
I found another -moz-box issue related to iframe. I do not know whether it is the same bug related to this issue or not. Basically there are two iframe in the body (i.e. leftFrame and the rightFrame), and I set the body to "display: -moz-box", the left iframe set to "width: 80px" and the right iframe set to "-moz-box-flex: 1". This works fine in Google Chrome 18, but fail in FireFox 12 (the left iframe does not obey the width setting which should be 80px, and you can also notice there are a vertical scroll bar shown which should not be there. Here is the test case: http://jsfiddle.net/TfjzC/
Comment 12•11 years ago
|
||
Pretty sure the original bug here doesn't require replaced elements -- it's broken on any children of a -moz-box element that happen to have a percent width. Reduced testcase to demonstrate that coming up.
Component: Layout: HTML Frames → Layout
OS: Linux → All
Hardware: x86_64 → All
Summary: Replaced element with percentage width/height in -moz-box gets wrong width and height → Percentage width/height in -moz-box gets wrong width and height
Version: unspecified → Trunk
Comment 13•11 years ago
|
||
Updated•11 years ago
|
Summary: Percentage width/height in -moz-box gets wrong width and height → Percentage width/height not honored on children of a -moz-box element
Comment 15•10 years ago
|
||
This testcase demonstrates the same behavior for "max-width: [percent]" -- it seems to be disregarded in Firefox (with -moz-box), but not in Chrome (with -webkit-box).
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•