overflow-applies-to-001.xht (2237B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <title>CSS Test: What overflow applies to</title> 6 7 <link rel="help" href="http://www.w3.org/TR/CSS22/visufx.html#overflow" /> 8 <link rel="help" href="http://www.w3.org/TR/CSS22/changes.html#s.11.1.1a" /> 9 <link rel="match" href="overflow-applies-to-001-ref.xht" /> 10 <meta name="assert" content="Name: overflow [...] Applies to: 11 block containers and boxes that establish a formatting context" /> 12 <link rel="author" title="Bert Bos" href="mailto:bert@w3.org" /> 13 14 <style type="text/css"> 15 #container {width: 20em; background: red; text-align: center; 16 line-height: 1.2em} 17 18 /* The visible overflow of grandchild1 hides the red container background */ 19 #child1 {width: 10em; overflow: visible} 20 #grandchild1 {width: 20em; background: green} 21 22 /* The red border on grandchild2 is clipped by child2 */ 23 #child2 {width: 20em; background: green; overflow: hidden} 24 #grandchild2 {width: 20em; border-right: solid 1em red} 25 26 /* Overflow (and width) don't apply to child3 and so grandchild3 is visible */ 27 #child3 {display: inline; width: 10em; overflow: hidden; background: red} 28 #grandchild3 {width: 20em; height: 1.2em; background: red; 29 vertical-align: bottom} 30 31 /* Child4 establishes a formatting context and so can clip grandchild4 */ 32 #child4 {table-layout: fixed; width: 20em; border-collapse: collapse; 33 background: green; overflow: hidden} 34 #grandchild4 {width: 20em; background: green; border-right: solid 1em red; 35 margin-right: -1em} 36 </style> 37 </head> 38 39 <body> 40 41 <p>There should be no red.</p> 42 43 <div id="container"> 44 <div id="child1"> 45 <div id="grandchild1"> 46 Block 1 47 </div> 48 </div> 49 50 <div id="child2"> 51 <div id="grandchild2"> 52 Block 2 53 </div> 54 </div> 55 56 <div id="child3"> 57 <img id="grandchild3" src="support/1x1-green.png" alt="Image download support must be enabled" /> 58 </div> 59 60 <table id="child4"> 61 <tr> 62 <td> 63 <div id="grandchild4"> 64 Block 4a 65 </div> 66 </td> 67 </tr> 68 <tr><td>Block 4b</td></tr> 69 </table> 70 </div> 71 </body> 72 </html>