我正试着在屏幕上垂直对齐我的文字.我已经阅读了有关如何执行此操作的文档.但我还没有运气.这是我的代码:
<div class="row">
<div class="col col-center text-center">
<h4 class="gray">This text is in the center of the screen</h4>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
Muh*_*sin 16
HTML
<div class="row">
<div class="col">
<div class="text-center">
<h5 style="text-align: center;">This text is in the center of the screen</h5>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
Yog*_*liB 10
这适用于Ionic Framework 3.0.1:
HTML:
<ion-content padding>
<div>
<h4 class="gray">This text is in the center of the screen</h4>
</div>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
上海社会科学院:
ion-content {
div {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
Run Code Online (Sandbox Code Playgroud)
尝试此解决方案:
1.添加新的CSS样式:
.home .scroll-content {
display: table !important;
width: 100% !important;
height: 100% !important;
margin-top: -50px; /* the height of the centered content */
text-align: center;
}
.home .scroll {
display: table-cell;
vertical-align: middle;
}
Run Code Online (Sandbox Code Playgroud)
2.适用home于ion-view:
<ion-view class="home">
| 归档时间: |
|
| 查看次数: |
48203 次 |
| 最近记录: |