html - 分区中的分区 : layout question

标签 html css

我创建了以下布局:

<div class="title" id="m1">
    <div class="chkbx">something</div>
    <div class="name">
        <a href="#" onclick="doSomething('1');">Dummy #1</a>
    </div>
</div>
// .. the div above repeats several times

我正在使用以下 CSS:

div.title { border: 1px black solid; }
div.chkbx {
    clear:both;
    float:left;
    padding:2px;
    text-align:right;
    width:5%;
}
 div.name {
    float:left;
    width: 50%;
}

并且希望所有 class=title 周围都有边框,但在顶部只能看到一些奇怪的线条。请让我知道我做错了什么。

非常非常感谢!

最佳答案

您可能正在 float 内容。在容器上设置 overflow: hidden

关于html - 分区中的分区 : layout question,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2765755/

相关文章:

javascript - 单击时移动按钮并替换为文本

html - 如果用户调整浏览器大小,我如何制作水平滚动条?

php - 列中的 Wordpress 帖子

javascript - 占位符的替代品,以便在 Internet Explorer 中工作

java - 在某些网站上无法使用 jSoup 找到 OpenGraph 标签

html - Anchor Titles 是否有最佳/最大长度?

html - 响应式设计如何正确使用css媒体查询

javascript - 在 jquery Mobile 中获取表单 ID 'pageshow'

html - 视频不会停留在行 Bootstrap 的第二列

javascript - 在javascript中创建动态链接?