【发布时间】:2018-12-20 17:18:07
【问题描述】:
我需要给离子卡一个全宽。这有效:
ion-card{
display: flex;
flex-direction: column;
width: 100% !important;
margin: 0 !important;
}
但我只需要将其限制为ion-content 的孩子。所以尝试了这个。但它不起作用。即它删除了卡片的整个宽度。有什么线索吗?
ion-content>ion-card{
display: flex;
flex-direction: column;
width: 100% !important;
margin: 0 !important;
}
html
<ion-header>
<ion-card>
<h2>Notifications Area1</h2>
</ion-card>
</ion-header>
<ion-content>
<ion-card>
<h2>Notifications Area2</h2>
</ion-card>
</ion-content>
注意:我不需要为ion-header 卡片应用全宽。
【问题讨论】:
-
子 100% 的宽度是父的 100%,如果父不会有 100%,那么它的子也是。
-
哦.. 抱歉,我没听懂你说的。你能给出一个代码示例我该怎么做? @ItayGal
-
jsfiddle.net/dew0cLxq 你很接近,只需将
>替换为空格即可 -
我想也许你没有在你的例子中使用离子框架。使用 ionic 并且在设备上
>无法正常工作。 @ReSedano -
@Sampath 啊,好吧!很高兴知道。谢谢:-)
标签: html css angular sass ionic3