[英]Styling ion-checkbox
I had the style below for ion-checkbox that I used in ionic 3. I want to use the same style in ionic 4 checkbox: 我在离子3中使用了下面的ion-checkbox样式。我想在ionic 4中使用相同的样式:
.ion-checkbox .ion-checkbox-icon {
border-radius: 2px;
position: relative;
width: 50px;
height: 50px;
border-color: #dedede;
background-color: #ffffff;
}
.ion-checkbox .ion-checkbox-checked .ion-checkbox-inner {
left: 16px;
top: 5px;
position: absolute;
width: 14px;
height: 27px;
border-color: #427feb;
border-top-width: 0;
border-right-width: 4px;
border-bottom-width: 4px;
border-left-width: 0;
}
.ion-checkbox-md .ion-checkbox-checked {
border-color: #fafafb;
background-color: #f9f9f9;
}
The style doesn't work in ionic 4. What am I missing? 该样式在ionic 4中不起作用。我想念什么?
Try reinstall the latest ionic. 尝试重新安装最新的离子。 It worked for me.
它为我工作。
npm i -g ionic@latest
I had to reference ion-checkbox as an element rather than class. 我不得不引用ion-checkbox作为元素而不是类。
Here is what worked for me; 这是对我有用的东西;
ion-checkbox {
background: #ffffff;
border-width: 1px !important;
border-style: solid !important;
border-radius: 4px;
border-color: grey !important;
--height: 35px;
--width: 35px;
--checkmark-color: #4870f2;
--background-checked: #ffffff;
--border-color: #ffffff;
--border-color-checked: #ffffff;
}
More details on custom properties can be found here from the official documentation. 自定义属性的更多细节可以发现这里从官方文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.