Guest User

Untitled

a guest
Jun 24th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <!-- keep IE in quirks mode -->
  2. <!DOCTYPE html>
  3. <html>
  4.   <head>
  5. <!-- This following meta tag does no good since there is no way to trigger quirks
  6. mode only in IE7. The problems with an xml prolog that triggered quirks mode were
  7. fixed in IE7, but this meta tag was not yet introduced, so the only thing you can do
  8. is trigger IE-wide quirks via the comment before the DOCTYPE //-->
  9.     <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
  10.     <style type="text/css">
  11. /*You still need an unbroken chain of 100% from the viewport down to the 'table'
  12. container*/
  13. html, body, #wrapper { margin: 0px; padding: 0px; height:100%; }
  14.  
  15. /* This is the heart of the new layout. You don't even need to worry about
  16. min-height vs. height issues, because table handle those fine without weird issues
  17. when the browser window becomes smaller than the content.*/
  18. #wrapper { display: table; width: 100%; }
  19. #header { display: table-row; height: 99px; }
  20. #logo { display: table-cell; }
  21. #header_contents { display: table-cell; }
  22. #container { display: table-row; }
  23. /* This is the one min-X needed, it prevents the sidebar from collapsing down to
  24. it's contents width when the containing div tries to shrink due to the window being
  25. shrunk down*/
  26. #sidebar { display: table-cell; width: 200px;
  27. min-width: 200px; vertical-align: top;}
  28. #content { display: table-cell; }
  29.  
  30. /* Fluff, purely for illustration of the containers */
  31. .box { width: 100px; height: 100px; background: grey; }
  32. #content .box { width: 300px; }
  33. #header_contents { border: 2px solid green; background-color: #cfc; }
  34. #sidebar { border: 1px solid blue; background-color: #ccf; }
  35. #content { border: 2px solid red; background-color: #fcc; }
  36. </style>
  37. <!-- The quirks mode based IE approach below. Since in that box model paddings and
  38. margins are not additive with the contents width/height, you can just add some
  39. paddings to the parent. For an explanation of the sidebar negative margin tricks,
  40. google 'holy grail css.' And the header is just absolutely positioned over the space
  41. created by the padding trick on the container //-->
  42. <!--[if IE]>
  43. <style type="text/css">
  44. #wrapper, #logo, #header, #container, #sidebar, #content { display: block }
  45. #header { position: absolute; padding-left: 200px; }
  46. #logo { float:left; height:100%; width:200px; margin-left: -200px; }
  47. #header_contents { height: 100%; width:100%; float:left;}
  48. #sidebar { float: left; height: 100%; margin-left: -200px; }
  49. #container { height: 100%; padding-top: 99px; padding-left: 200px; }
  50. #content { height: 100%; width: 100%; float: left; }
  51. </style>
  52. <![endif]-->
  53.   </head>
  54.   <body>
  55.     <div id="wrapper">
  56.       <div id="header">
  57.         <div id="logo">Logo</div><div id="header_contents">Header</div>
  58.       </div>
  59.       <div id="container">
  60.         <div id="sidebar"><div class="box">Sidebar</div></div>
  61.         <div id="content">
  62.           <div class="box"></div>
  63.         </div>
  64.       </div>
  65.     </div>
  66.   </body>
  67. </html>
Add Comment
Please, Sign In to add comment