【发布时间】:2015-10-28 11:56:59
【问题描述】:
我正在努力尝试垂直对齐我的一个文本字段。
我希望我的章节名称Integers and the Coordinate Plane 位于我的红线中间。
我试过使用垂直对齐,但我可能用错了。
有人可以解释一下吗?
Fiddle
HTML
<div class="row chapter-detail">
<div class="col-xs-4 col-sm-2 col-md-2 col-lg-1 no-padding ">
<div class="ch-d-wrapper">
<div class="ch-d-chapter ">CHAPTER</div>
<div class="ch-d-num">6</div>
</div>
</div>
<div class="col-xs-8 col-sm-10 col-md-10 col-lg-11 no-padding ">
<div class="ch-d-name">Integers and the Coordinate Plane</div>
</div>
</div>
少
.chapter-detail {
border: solid #c9cacb 1px;
background-color: #F9F9F9;
color: #293644;
margin-bottom: 10px;
margin-left: 3px;
margin-right: 35px;
margin-top: 30px;
line-height: 38px;
.ch-d-wrapper {
text-align: center;
border-right: solid #c9cacb 2px;
}
.ch-d-chapter{
text-transform: uppercase;
font-size: 12px;
}
.ch-d-num {
font-weight: bold;
font-size: 35px
}
.ch-d-name {
font-size: 23px;
vertical-align: middle;
}
}
【问题讨论】:
-
与
.col-xs-8.col-sm-10.col-md-10.col-lg-11.no-padding { margin-top: 20px; }一起使用。 -
@somethinghere - 为什么
text-align: center会垂直居中? -
@somethinghere:我知道
text-align:center我想垂直对齐。在发表评论之前你有没有看过我的帖子? -
他的评论甚至还获得了 1 票支持。我很惊讶。
-
文字和行不一样。请保持问题开放。它将帮助遇到相同问题并正在搜索“line”而不是“text”的人。
标签: html css twitter-bootstrap less