html - How can I make two iframes fit the width of the page? -


my issue have 2 iframes on page, 1 persistent side menu , 1 main body content. want side menu take 12% of screen (just personal choice) , content fit rest of page width. i've seen many solutions fitting single iframe onto page cannot find specific issue exactly.

i tried setting bodycontent iframe's width 88% 88 + 12 = 100, makes iframe appear below menu iframe. guess 100% wide page in case...? rudimentary solution set width of bodycontent 87.6% (87.7% much) fits full width of page tiny sliver of white along right border.

i know there must more simple solution problem 2 iframe's can cleanly fit full width of page. how go doing so?

here's have right (the iframe's sources .aspx files have hidden):

<!doctype html> <html>     <head>         <title>foo</title>         <meta http-equiv="content-type" content="text/html; charset=utf-8" />         <meta http-equiv="content-language" content="en-us" />                <style>             .menu {                 float: left;                 width: 12%;             }             .bodycontent {                 float: left;                 width: 87.6%;                 border: none;             }             body {                 margin: 0;                 padding: 0;             }             div#root {                 position: fixed;                 width: 100%;                 height: 100%;             }             div#root > iframe {                 height: 100%;             }         </style>           </head>           <body>         <div id="root">             <iframe class="menu" src="hidden"></iframe>             <iframe class="bodycontent" src="hidden"></iframe>         </div>     </body> </html> 

your iframe width not include border default. border 2px wide default. include it, add box-sizing: border-box; css style include border in iframe width.

jsfiddle

iframe {     box-sizing: border-box; /*include borders in width calculation */ } .menu {     float: left;     width: 12%; } .bodycontent {     float: left;     width: 88%; /*width can 88%*/     /*border: none; removed can see iframe in example*/ } 

here similar question , solution


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -