【发布时间】:2018-11-30 04:32:04
【问题描述】:
我需要一个画布作为 div 的背景,所以我放了一个与它重叠的画布。然而,它并没有填满整个事情。我尝试设置左侧、右侧、顶部和底部,并将边距和填充设置为 0,但它不起作用。 LINK。 CSS:
body {
background: white;
padding: 20px;
font-family: Helvetica;
height:100%;
}
#editor_contentwrapper{
box-sizing: border-box;
background: #353535;
position: absolute;
height:100%;
width:70%;
left:0px;
top:0px;
overflow-y: scroll;
padding-top:30px;
}
#editor_settings{
background: gray;
position: absolute;
height:100%;
width:30%;
left:70%;
top:0px;
}
#editor_editor{
background: white;
width:90%;
min-width:400px;
min-height:100%;
margin:auto;
}
#editor_canv{
position:relative;
left:0;
top:0;
background:red;
width:100%;
height: 100%;
}
HTML:
<div id=editor_contentwrapper>
<div id=editor_editor>
<canvas id=editor_canv></canvas>
</div>
</div>
<div id=editor_settings></div>
【问题讨论】:
-
在调整 div 的大小时是否需要调整画布的大小?
-
是的,画布的大小和位置应与 div 相同。
标签: jquery html css html5-canvas