简体   繁体   English

禁用方形边框 InputRadioGroup

[英]Disabled square border InputRadioGroup

When use a Blazor InputRadioGroup component, after choice, a square border is drawn in all options - Can it disabled this, sample:当使用 Blazor InputRadioGroup 组件时,选择后,在所有选项中绘制一个方形边框 - 是否可以禁用此功能,示例:

@page "/RatioButtons"
<h3>Ratio Buttons</h3>
<div>
    <EditForm Model="person">
        <InputRadioGroup Name="age" @bind-Value="person.Age">
            Set Age:<br />
            @for (int i = 18; i < 36; i++) {
                <InputRadio Value="@i" />
                @($" Age {i}")<br />
            }
        </InputRadioGroup>
    </EditForm>
</div>
<br />
<div class="card p-3" >
    <h5>@person.FirstName @person.LastName : @person.Age</h5>
</div>

@code {
    class Person
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int Age { get; set; }
    }

    Person person = new Person {
        FirstName = "Alexa",
        LastName = "Ansley",
        Age = 24
    };
}

I tried global CSS, restart application, and nothing.我尝试了全局 CSS,重新启动应用程序,什么也没有。

input[type="radio"]:focus {
    outline: none !important;
}

Thanks in advance提前致谢在此处输入图像描述

set this code:设置此代码:

@for (int i = 18; i < 36; i++) {
     <InputRadio Value="@i" style="border:none;"/>
     @($" Age {i}")<br />
}

or或者

 input[type="radio"]:focus {
   border: none !important;
}

The reason for the green border is because when you create a new Blazor app, the template has this css in the site.css file:绿色边框的原因是因为当你新建一个 Blazor 应用程序时,模板在 site.css 文件中有这个 css 文件:

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

One way to remove the border from radio buttons would be to add :not([type=radio]) to it like this:从单选按钮中删除边框的一种方法是添加:not([type=radio]) ,如下所示:

.valid.modified:not([type=checkbox]):not([type=radio]) {
    outline: 1px solid #26b050;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM