| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <title>WebKit 50% width issue</title> |
|---|
| 5 | </head> |
|---|
| 6 | <body> |
|---|
| 7 | |
|---|
| 8 | <!-- FIX 1: Remove white-space:nowrap; (WAT!) --> |
|---|
| 9 | <div style="white-space:nowrap;float:left;outline:1px solid red"> |
|---|
| 10 | <table> |
|---|
| 11 | <tr> |
|---|
| 12 | <td style="width:200px"> |
|---|
| 13 | <!-- Fix 2: remove float:left (WAT!) --> |
|---|
| 14 | <table style="width:100%;float:left"> |
|---|
| 15 | <tr> |
|---|
| 16 | <td> |
|---|
| 17 | <!-- Remove width:100% to trigger the issue in Chrome 24 as well --> |
|---|
| 18 | <table style="width:100%"> |
|---|
| 19 | <tr> |
|---|
| 20 | <td style="width:50%"> |
|---|
| 21 | Cell 1 |
|---|
| 22 | </td> |
|---|
| 23 | <td style="width:50%"> |
|---|
| 24 | <div style="width:400px;outline: 1px solid blue"> |
|---|
| 25 | Cell 2, with a 400px DIV. |
|---|
| 26 | </div> |
|---|
| 27 | </td> |
|---|
| 28 | </tr> |
|---|
| 29 | </table> |
|---|
| 30 | </td> |
|---|
| 31 | </tr> |
|---|
| 32 | </table> |
|---|
| 33 | </td> |
|---|
| 34 | </tr> |
|---|
| 35 | </table> |
|---|
| 36 | </div> |
|---|
| 37 | |
|---|
| 38 | <br style="clear:both"> |
|---|
| 39 | <p> |
|---|
| 40 | The red DIV has been forced to be 200px wide but it has a 400 px (blue) DIV inside of it. Therefore, "Cell 1" should shrink to its very minimum, but it is matching the sice of "Cell 2". |
|---|
| 41 | </p> |
|---|
| 42 | |
|---|
| 43 | <p> |
|---|
| 44 | Check the comments for two possible "fixes" :/ |
|---|
| 45 | </p> |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | </body> |
|---|
| 49 | </html> |
|---|