如何使用边框与Bootstrap [英] How to use border with Bootstrap
本文介绍了如何使用边框与Bootstrap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何解决这个问题?
当向div添加边框时,div不居中,
span12
类不居中。
How can I solve this problem?
When you add borders to a div, the div is not centered and
the span12
class is not centered.
我想以div为边界
<div class="row" >
<div class="span12" style="border: 2px solid black">
<div class="row">
<div class="span4">
1
</div>
<div class="span4">
2
</div>
<div class="span4">
3
</div>
</div>
</div>
</div>
推荐答案
不幸的是,这是边界做的,作为元素占据的空间的一部分。让我介绍一下边界不太常见的表哥: outline
。它几乎与边界相同。唯一的区别是它的行为更像是box-shadow,因为它不占用你的布局中的空间,它必须在元素的所有四边。
Unfortunately, that's what borders do, they're counted as part of the space an element takes up. Allow me to introduce border's less commonly known cousin: outline
. It is virtually identical to border. Only difference is that it behaves more like box-shadow in that it doesn't take up space in your layout and it has to be on all 4 sides of the element.
http://codepen.io/cimmanon/pen/wyktr
.foo {
outline: 1px solid orange;
}
这篇关于如何使用边框与Bootstrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文