首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >div上带有边框样式的div外部的HTML边框

问div上带有边框样式的div外部的HTML边框
EN

Stack Overflow用户
提问于 2016-03-10 21:00:58
回答 2查看 69关注 0票数 0

我目前正在经历以下问题,我不希望Samples这个词包装在一个边界中,我想说的是示例(它周围没有边界),它下面有一个<hr,然后是一个有边界的div列表。我不知道为什么样品是在这里,因为它是在我的边缘div之外。注意,我确信没有其他边界div包装这个html。下面的屏幕截图和HTML:

HTML:

代码语言:javascript
复制
<div class="col-md-12" style="margin-top: 75px">
        <h3 class="pull-left" style="font-size: 45px">Samples</h3>
    </div>
    <div class="col-md-12">
        <hr>
    </div>

    <div ng-controller="SamplesQueryController">
        <div style="border: 1px solid #000000">
            <div ng-repeat="item in data" style="margin-left: 14px">
                <a href="#/sample/{{item.id}}"
                    style="font-size: 34px; text-decoration: underline">{{item.name}}</a>
                <br> <span style="font-size: 20px">{{item.description}}</span><br>
                <hr>
            </div>
        </div>
    </div>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-03-10 21:29:11

行为来源于引导风格。为了避免这种情况,请将每一行封装在一个class="row" div中。

​

代码语言:javascript
复制
html {padding:2em; /*demo*/}
代码语言:javascript
复制
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
  <div class="col-md-12" style="margin-top: 75px">
    <h3 class="pull-left" style="font-size: 45px">Samples</h3>
  </div>
  <div class="col-md-12">
    <hr>
  </div>
</div>
<div class="row">
  <div ng-controller="SamplesQueryController">
    <div style="border: 1px solid #000000">
      <div ng-repeat="item in data" style="margin-left: 14px">
        <a href="#/sample/{{item.id}}" style="font-size: 34px; text-decoration: underline">{{item.name}}</a>
        <br> <span style="font-size: 20px">{{item.description}}</span><br>
        <hr>
      </div>
    </div>
  </div>
</div>

​

您的html:

​

代码语言:javascript
复制
    html {padding:2em; /*demo*/}
代码语言:javascript
复制
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-12" style="margin-top: 75px">
        <h3 class="pull-left" style="font-size: 45px">Samples</h3>
    </div>
    <div class="col-md-12">
        <hr>
    </div>
    <div ng-controller="SamplesQueryController">
        <div style="border: 1px solid #000000">
            <div ng-repeat="item in data" style="margin-left: 14px">
                <a href="#/sample/{{item.id}}"
                    style="font-size: 34px; text-decoration: underline">{{item.name}}</a>
                <br> <span style="font-size: 20px">{{item.description}}</span><br>
                <hr>
            </div>
        </div>
    </div>

​

票数 1
EN

Stack Overflow用户

发布于 2016-03-10 21:23:23

乍一看,这似乎是一个基本的明确问题。我注意到您正在使用引导程序的“拉左”助手类,并在父元素中添加一个清除修复类来修复这个问题。文档可以在这里找到:http://getbootstrap.com/css/#helper-classes-clearfix

我不完全确定为什么您需要在第一个place...maybe中浮动这个标题--需要更好地理解引导列系统,因为这可能是问题的根源。

最新答复:

代码语言:javascript
复制
<div style="margin-top: 75px">
    <h3 style="font-size: 45px">Samples</h3>
</div>

http://codepen.io/wgallop99/pen/Myeppy

删除拉左类和col-md-12部分修复它,但再次,如果您没有正确地使用引导列类,您可能会遇到更多的麻烦。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35927179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档