我有一个宽度为200px,高度为500px的主要区域。根据某些事件,我需要在主要区域中添加宽度为50px,高度为50px的子区域。我需要从左上角开始,向下延伸并向右流动添加。
我尝试了这些CSS,但它没有起作用。
|---------------|
| | |
| 1 | 4 |
|-------|-------|
| | |
| 2 | 5 |
|-------|-------|
| | |
| 3 | 6 |
|-------|-------|
我尝试了这些CSS,但它没有起作用。
.SubDiv {
height: 50px;
width: 50px;
background: red;
}
.MainDiv {
max-height: 200px;
height: 200px;
width: 200px;
background: blue;
min-width: 100px;
direction: inherit;
}
<div>
<div id="SimulationPage">
<div id = "ParentDiv" class="MainDiv">
</div>
</div>
<input type='button' id = "adddiv" value='add div' />
</div>
$(document).ready(function () {
$('#adddiv').bind('click', function (eventargs) {
$("#ParentDiv").append('<div class="SubDiv"> </div>');
});
});
能否有人帮助我实现我想要的。
div
,没有jQuery
是无法实现的! - NoobEditor