Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
michael@0 | 2 | <!-- |
michael@0 | 3 | Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 5 | --> |
michael@0 | 6 | <!-- Testcase with percent-valued padding and/or margin on flex items. The spec |
michael@0 | 7 | says that percentage values on padding/margin-top and -bottom should be |
michael@0 | 8 | resolved against the flex container's height (not its width, as would |
michael@0 | 9 | be the case in a block). |
michael@0 | 10 | --> |
michael@0 | 11 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 12 | <head> |
michael@0 | 13 | <title>CSS Test: Testing percent-valued padding and margin on flex items</title> |
michael@0 | 14 | <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/> |
michael@0 | 15 | <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#layout-algorithm"/> |
michael@0 | 16 | <link rel="match" href="flexbox-mbp-horiz-4-ref.xhtml"/> |
michael@0 | 17 | <style> |
michael@0 | 18 | div { border: 0; } |
michael@0 | 19 | div.flexbox { |
michael@0 | 20 | width: 200px; |
michael@0 | 21 | display: flex; |
michael@0 | 22 | margin-bottom: 2px; |
michael@0 | 23 | border: 1px dotted black; |
michael@0 | 24 | } |
michael@0 | 25 | div.height50 { height: 50px; } |
michael@0 | 26 | |
michael@0 | 27 | .marginA { margin: 10% 8% 6% 4%; } |
michael@0 | 28 | .marginB { margin: 8% 10% 12% 14%; } |
michael@0 | 29 | .paddingA { padding: 8% 6% 4% 2%; } |
michael@0 | 30 | .paddingB { padding: 6% 8% 10% 12%; } |
michael@0 | 31 | |
michael@0 | 32 | div.child1 { |
michael@0 | 33 | flex: none; |
michael@0 | 34 | width: 10px; |
michael@0 | 35 | height: 10px; |
michael@0 | 36 | background: lightgreen; |
michael@0 | 37 | } |
michael@0 | 38 | div.child2 { |
michael@0 | 39 | flex: none; |
michael@0 | 40 | width: 10px; |
michael@0 | 41 | height: 10px; |
michael@0 | 42 | background: purple; |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | div.filler { |
michael@0 | 46 | /* Filler-div to fill up content-box and make padding easier to see. */ |
michael@0 | 47 | height: 10px; |
michael@0 | 48 | width: 100%; |
michael@0 | 49 | background: lightgrey; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | </style> |
michael@0 | 53 | </head> |
michael@0 | 54 | <body> |
michael@0 | 55 | <!-- Flex container is auto-height - vertical margin and padding should |
michael@0 | 56 | resolve to 0, since they don't have anything to resolve % against. --> |
michael@0 | 57 | <div class="flexbox" |
michael@0 | 58 | ><div class="child1 paddingA"><div class="filler"/></div |
michael@0 | 59 | ><div class="child2 paddingB"><div class="filler"/></div |
michael@0 | 60 | ><div class="child1 marginA"></div |
michael@0 | 61 | ><div class="child2 marginB"></div |
michael@0 | 62 | ></div> |
michael@0 | 63 | |
michael@0 | 64 | <!-- Flex container has height: 50px - vertical margin and padding should |
michael@0 | 65 | resolve % values against that. --> |
michael@0 | 66 | <div class="flexbox height50" |
michael@0 | 67 | ><div class="child1 paddingA"><div class="filler"/></div |
michael@0 | 68 | ><div class="child2 paddingB"><div class="filler"/></div |
michael@0 | 69 | ><div class="child1 marginA"></div |
michael@0 | 70 | ><div class="child2 marginB"></div |
michael@0 | 71 | ></div> |
michael@0 | 72 | |
michael@0 | 73 | <!-- ...and now with align-items: flex-end, so we can see the margin-bottom |
michael@0 | 74 | in action --> |
michael@0 | 75 | <div class="flexbox height50" style="align-items: flex-end" |
michael@0 | 76 | ><div class="child1 paddingA"><div class="filler"/></div |
michael@0 | 77 | ><div class="child2 paddingB"><div class="filler"/></div |
michael@0 | 78 | ><div class="child1 marginA"></div |
michael@0 | 79 | ><div class="child2 marginB"></div |
michael@0 | 80 | ></div> |
michael@0 | 81 | |
michael@0 | 82 | <!-- ...and finally, with margin and padding applied to the same items --> |
michael@0 | 83 | <div class="flexbox height50" |
michael@0 | 84 | ><div class="child1 paddingA marginA"><div class="filler"/></div |
michael@0 | 85 | ><div class="child2 paddingB marginB"><div class="filler"/></div |
michael@0 | 86 | ></div> |
michael@0 | 87 | </body> |
michael@0 | 88 | </html> |