为什么会出现这个问题。我通过动态在 Hoursdiv 中添加了一个标签元素(数字)。
但问题是:- 元素没有以正确的方式添加。添加 6 个
元素后,创建了空间。
javascript代码:-
for(var i=1 ; i<=12; i++) {
(function () {
var cc=i;
if(cc<=9)
cc='0'+i;
var _id1 = "time"+cc;
str1 += "<a id='"+_id1+"' class='hournum a_Cal' >"+cc+"</a>";
}());
}
css 代码(h2ooooooo 编辑说明:我不知道是否'a_cal'
真的在 css 文件中,但我把它放在这里以防万一):
'a_cal'
.a_Cal{
text-decoration: none;
color: black;
width: 18%;
height: 11%;
float: left;
border-radius: 4px;
}
.hournum{
padding:5px;
}
.hoursdiv{
border: 1px solid #6699FF;
position: absolute;
top: 25%;
left: 4%;
text-align: center;
color: red;
width: 45%;
height: 52%;
background-color: white;
}