作者热门文章
- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我在一个 div 中有多个跨度,但都在同一行。我想在新行上写下每个跨度。这是 html 代码:
.divContent {
position: absolute;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 100%;
bottom: 5%;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
z-index: 2;
opacity: .8
}
.divContent span {
font-size: 0.875rem;
color: #4D575D;
margin: 0 3px;
}
<div id="content" class="divContent">
<span>Span 1</span>
<span>Span 2</span>
<span>Span 3</span>
</div>
现在这段代码的结果是:跨度 1 跨度 2 跨度 3
但是我想要
跨度 1
跨度 2
跨度 3
最佳答案
更改 direction到列
:
.divContent {
position: absolute;
display: flex;
flex-direction: column; /*added this */
width: 100%;
bottom: 5%;
justify-content: center;
align-items:center; /*added this if you want centring*/
z-index: 2;
opacity: .8
}
.divContent span {
font-size: 0.875rem;
color: #4D575D;
margin: 0 3px
}
<div id="content" class="divContent">
<span>Span 1</span>
<span>Span 2</span>
<span>Span 3</span>
</div>
关于html - 如何在新行上创建跨度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52367104/
我是一名优秀的程序员,十分优秀!