gpt4 book ai didi

css - ionic View 内容中的垂直对齐 div

转载 作者:行者123 更新时间:2023-11-28 05:48:16 25 4
gpt4 key购买 nike

我正在尝试在 ionic View 中垂直对齐 div。我指的是this codepen .此代码笔中的示例适用于没有标题的 ionic View 。但是,如果我按如下所示包含标题,则它不会正确垂直对齐。

在这种情况下,我该怎么做才能使其垂直对齐?

<body ng-controller="AppCtrl as ctrl">
<ion-header-bar align-title="left" class="bar-positive">
<div class="buttons">
<button class="button" ng-click="doSomething()">Left Button</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
<ion-content has-header="true" padding="true">
<div class="row row-center">
<div class="col col-center">
You need to login
</div>
</div>
<div class="row">
<div class="col">
<button class="button button-block button-positive">
Go to Login
</button>
</div>
</div>
</ion-content>

</body>

最佳答案

.center1{
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-moz-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: center;
-moz-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}

将以下类添加到您的 CSS。

关于css - ionic View 内容中的垂直对齐 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37494960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com