简体   繁体   English

HTML页面中的DIV定位

[英]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. 这里所有div都包含一些组件。.仅显示了外部布局。

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. 我的要求是canvas div应该占据父div“ outerwindow”的80%的高度。我面临的问题与我为画布指定的宽度和高度无关,高度仅是外部窗口的一半。但是width是外部窗口的100%外部窗口。请提供帮助。

change g_Painter position style to absolute g_Painter位置样式更改为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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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