简体   繁体   中英

DIv positioning in html page

<body>
<div id="outerwindow" style= "position:absolute ;width:100%;height:100%" >

<div>
<canvas id="g_Painter" style="position:relative;width:100%;height:80%"></canvas>
    </div>
<div id="g_Toolbar" >

</div>
div id="innerdiv" >

</div>
</div>
</body >

Here all div contains some components..Only outer layout I have shown.

My requirement is the canvas div should occupy the 80% height of parent div "outerwindow" .Problem I am facing is irrespective of whatever width and height I specify to canvas, height is only almost half of the outerwindow.But width is 100% of the outerwindow.Kindly help.

change g_Painter position style to absolute

<body>
<div id="outerwindow" style= "position:absolute;width:100%;height:100%;" >
  <div>
    <canvas id="g_Painter" style="position:absolute;width:100%;height:80%;"></canvas></div>
  <div id="g_Toolbar"></div>
  <div id="innerdiv"></div>
</div>
</body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM