gpt4 book ai didi

html - radio 输入样式不适用于 Firefox

转载 作者:行者123 更新时间:2023-11-28 03:51:31 26 4
gpt4 key购买 nike

所以我使用下面的 CSS 设置了我的 radio 输入的样式。但是在 Firefox 中,出现了一个完全不同的 radio ,我根本无法设置它的样式。

它在 safari 和 chrome 中完美运行,但我似乎无法弄清楚为什么它在 Firefox 中不起作用。

 input[type=checkbox] {
border: 0px;
cursor: pointer;
height: 20px;
margin: 0px 10px 0px 0px;
position: relative;
overflow: hidden;
vertical-align: -5px;
width: 20px;
}
input[type=checkbox]:before {
background-color: transparent;
border: 2px solid #E0E0E0;
content: '';
display: block;
height: 20px;
left: 0px;
opacity: 1;
position: absolute;
transition: opacity .15s linear;
top: 0px;
width: 20px;
}
input[type=checkbox]:after {
border: 2px solid #EC407A;
content: '';
display: block;
height: 23px;
left: -5px;
opacity: 0;
position: absolute;
top: -9px;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transition: opacity .15s linear;
width: 27px;
}
input[type=checkbox]:checked:before {
opacity: 0;
}
input[type=checkbox]:checked:after {
opacity: 1;
}
input[type=checkbox]:focus {
box-shadow: none;
outline: 0px;
}
.radio-wrapper {
position: relative;
}
input[type='radio'] {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
position: relative;
right: 0;
bottom: 0;
left: 0;
height: 20px;
width: 20px;
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
background: #cbd1d8;
border: none;
color: #fff;
cursor: pointer;
display: inline-block;
outline: none;
position: relative;
border-radius: 50%;
}
@-webkit-keyframes click-wave {
0% {
height: 40px;
width: 40px;
opacity: 0.35;
position: relative;
}
100% {
height: 200px;
width: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
@-moz-keyframes click-wave {
0% {
height: 40px;
width: 40px;
opacity: 0.35;
position: relative;
}
100% {
height: 200px;
width: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
@keyframes click-wave {
0% {
height: 40px;
width: 40px;
opacity: 0.35;
position: relative;
}
100% {
height: 200px;
width: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
.option-input {
-webkit-transition: all 0.15s ease-out 0s;
-moz-transition: all 0.15s ease-out 0s;
transition: all 0.15s ease-out 0s;
background: #7CE1C9;
border: none;
color: #fff;
cursor: pointer;
display: inline-block;
outline: none;
position: relative;
margin-right: 0.5rem;
}
.option-input:hover {
background: #9faab7;
}
.option-input:checked {
background: #7CE1C9;
}
.option-input:checked::before {
height: 20px;
width: 20px;
position: relative;
content: '\2716';
display: inline-block;
font-size: 14.66667px;
text-align: center;
line-height: 20px;
}
.option-input:checked::after {
-webkit-animation: click-wave 0.65s;
-moz-animation: click-wave 0.65s;
animation: click-wave 0.65s;
background: #7CE1C9;
content: '';
display: block;
position: relative;
}
.option-input.radio {
border-radius: 50%;
}
.option-input.radio::after {
border-radius: 50%;
}
input[type='radio'] + label {
user-select: none;
cursor: pointer;
padding-left: 30px;
}
input[type='radio'] + label:before,
input[type='radio'] + label:after {
background: #fff;
background-clip: padding-box;
border: 2px solid #EC407A;
border-radius: 50%;
bottom: 3px;
content: '';
display: block;
height: 16px;
left: 3px;
margin-top: -8px;
position: absolute;
top: 50%;
transition: all 0.3s ease;
width: 16px;
}
input[type='radio'] + label:after {
background: #7CE1C9;
border: 2px solid #fff;
transform: scale(0);
-wekbit-transform: scale(0);
transition: all 0.3s ease;
}
input[type='radio']:focus + label:before {
box-shadow: 0 0 5px #EC407A;
}
input[type='radio']:checked + label:before {
border-color: #EC407A;
}
input[type='radio']:checked + label:after {
transform: scale(0.75, 0.75);
-webkit-transform: scale(0.75, 0.75);
}
`
<form>
<li class='initialForm'><span class='optionText'>$option1</span><strong><input type='radio' class='option-input radio option1' id='$id' value='1' name='option'></strong>
</li>
<li class='initialForm'><span class='optionText'>$option2</span><strong><input type='radio' class='option-input radio option2' id='$id' value='2' name='option'></strong>
</li>
</form>

最佳答案

您正在使用 -webkit CSS 前缀,它专门用于 Chrome 和 Safari(或基于 webkit 的浏览器)。

您还应该使用 -moz CSS 前缀,特别是针对 Firefox。当然,如果您想支持 IE,它们可能对某些方法有额外的或不同的样式。

特别是对于你的transform方法,在Firefox中它被认为是实验性的,也许-moz-transform更合适。

关于html - radio 输入样式不适用于 Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31416949/

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