[英]CSS How to center an item in Ionic
I am using Ionic3, and have the following: 我正在使用Ionic3,并且具有以下功能:
I would like to center align the ion-card. 我想使离子卡居中对齐。
html html
<div class="contracted-content">
<ion-card class="job-card">
...
</ion-card>
<div class="person-job">
<ion-row>
...
</ion-row>
</div>
</div>
scss 脚本
.contracted-content {
max-width: 369px;
align-content: center;
}
As you can see, I set the max width to 369px, so that the image does not distort. 如您所见,我将最大宽度设置为369px,以使图像不会变形。 Now, when the browsers width gets increased beyond the 369px, I would like to center the
div
(the align-content: center;
has no affect). 现在,当浏览器的宽度增加到超过369px时,我想将
div
居中( align-content: center;
没有影响)。
Any advise appreciated. 任何建议表示赞赏。
Try using margin: 0 auto;
尝试使用
margin: 0 auto;
to center your element 使您的元素居中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.