gpt4 book ai didi

html - 如何使单选按钮具有更粗的轮廓

转载 作者:行者123 更新时间:2023-11-28 10:07:43 25 4
gpt4 key购买 nike

我想拥有这样的东西 https://design-system.service.gov.uk/components/radios/用于单选按钮。

问题是单选按钮的焦点,我的看起来像这样:

enter image description here

它应该是这样的:

enter image description here

我尝试复制该部分的代码并将其放在 jsfiddle 中,但效果不佳。这就是我最终得到的:https://jsfiddle.net/jcL38wu7/1/

.multiple-choice [type=radio]:focus+label::before, .multiple-choice [type=checkbox]:focus+label::before {
-webkit-box-shadow: 0 0 0 4px $focus;
-moz-box-shadow: 0 0 0 4px $focus;
box-shadow: 0 0 0 4px $focus;
}

.div-table__cell--action{margin-bottom:0}

.div-table__cell:last-of-type{padding-right:0}

.div-table__cell--action{min-height:40px;min-width:160px}

[type=radio]+label::before{
content:"";
border:2px solid;
background:transparent;
width:34px;
height:34px;
position:absolute;
top:0;left:0;
-webkit-border-radius:50%;
-moz-border-radius:50%;
border-radius:50%}

input{font-size:inherit;font-family:inherit;line-height:inherit;font-weight:normal;}
input{font-family:"nta",Arial,sans-serif;}
input:focus{outline:3px solid #ffbf47;outline-offset:0;}
.multiple-choice input{position:absolute;cursor:pointer;left:0;top:0;width:38px;height:38px;z-index:1;margin:0;zoom:1;filter:alpha(opacity=0);opacity:1;}
.multiple-choice input:disabled{cursor:default;}
input:focus{outline:3px solid #fd0!important;outline-offset:0;box-shadow:inset 0 0 0 2px;}
<div class="div-table__cell div-table__cell--action">
<div class="multiple-choice multiple-choice--booking">
<input id="radio-{event.id}"
type="radio" name="selected-date"
class="multiple-choice__input"
>
</div>
</div>

我希望任何人都可以告诉我如何使焦点半径变粗。谢谢

最佳答案

您需要在单选按钮上使用自定义样式。

https://jsfiddle.net/charumaheshwari/25x3bntw/6/ 更新了 fiddle

如果您需要有关它的工作的更多信息,可以再次还原,:)

.wrapper {
margin:50px;
position:relative;
}
.multiple-choice__input {
cursor: pointer;
position: absolute;
z-index: 1;
top: -2px;
left: -2px;
width: 44px;
height: 44px;
margin: 0;
opacity: 0;
}
.multiple-choice label::before {
content: "";
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
width: 40px;
height: 40px;
border: 2px solid currentColor;
border-radius: 50%;
background: transparent;
}

.multiple-choice label::after {
content: "";
position: absolute;
top: 10px;
left: 10px;
width: 0;
height: 0;
border: 10px solid currentColor;
border-radius: 50%;
opacity: 0;
background: currentColor;
}
.multiple-choice__input:checked + label::after {
opacity: 1;
}
.multiple-choice__input:focus + label::before {
border-width: 4px;
-webkit-box-shadow: 0 0 0 4px #fd0;
box-shadow: 0 0 0 4px #fd0;
}
<body>
<div class="wrapper">


<div class="div-table__cell div-table__cell--action">
<div class="multiple-choice multiple-choice--booking">
<input id="radio-1" type="radio" name="selected-date" class="multiple-choice__input">
<label for="radio-1">

</label>
</div>
</div>
</div>

</body>

关于html - 如何使单选按钮具有更粗的轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59174551/

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