html - div float 问题

标签 html css wordpress

好的,所以我得到了这个 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 的正下方)吗?

这是博客: http://prime.programming-designs.com/blog/

最佳答案

你的样式表中有这段代码:

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/

相关文章:

html - 彼此相邻的div的行为

html - 相对父级的 CSS 相对定位高度

javascript - 覆盖横幅不显示在移动 View 中

mysql - SQL连接wordpress表

WordPress:本地主机上的自定义默认头像?

javascript - 清除 URL 哈希

html - 如何让页脚保持在页面底部?

html - 为按钮使用背景图像。如何根据文本的长度调整按钮的大小?

css - 选择 <option></option> 标签内的内容

wordpress - Woocommerce 变量保护 "No products matched your selection"