好的,所以我得到了这个 div:
#content .entry-title {
color: #5d9851;
font-size: 21px;
font-weight: bold;
line-height: 1.3em;
margin-left: 30px;
width: 520px;
overflow: hidden;
border-bottom: 1px solid #97fb83;
}
它不会像 .stripedbar 那样放在 .grayblock 的一边:
.stripedbar{
background-position:left top;
background-repeat: repeat;
background-image:url('images/bar.png');
height: 20px;
width: 520px;
margin-left: 30px;
margin-bottom: 0px;
}
.grayblock{
background-color: #cccccc;
height: 40px;
width: 20px;
float: left;
}
知道如何让它更好地播放(在 .grayblock 的旁边,在 .stripedbar 的正下方)吗?
最佳答案
你的样式表中有这段代码:
h1, h2, h3, h4, h5, h6 {
clear: both;
font-weight: normal;
}
因此,.entry-title
block 正在清除 .grayblock
的 float 。
您需要将 clear:none;
添加到 #content .entry-title
样式,它会很好用。
关于html - div float 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4826784/