【问题标题】:Radio Button CSS3 - Customization单选按钮 CSS3 - 自定义
【发布时间】:2015-08-16 19:58:45
【问题描述】:

我正在尝试自定义引导程序上的单选按钮,但它不起作用,当我在纯 HTML 中尝试外部引导程序环境时它可以工作,下面是 HTML 代码,后面是我正在使用的 CSS

<div class="radio">
        <label>
          <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
          My Current AMP Policies
        </label>
      </div>
      <div class="radio">
        <label>
          <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
          Financial Planning and Retirement Advice
        </label>
      </div>
      <div class="radio">
        <label>
          <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3">
           LifeCover
        </label>
      </div>

CSS

.newradio input[type=radio] {display: none;}
.newradio label {
display: inline-block;
cursor: pointer;
position: relative;
padding-left: 25px;
margin-right: 15px;
font-size: 13px;
}
.newradio label:before {
content: "";
display: inline-block;
width: 14px;
height: 14px;
border-radius: 7px;
margin-right: 10px;
position: absolute;
left: 0;
bottom: 3px;
background-color: #fff;
border:solid 1px #bcb882;
}
.newradio input[type=radio]:checked + .newradio label:before {
content: "";
background: url(../../Content/images/radio-check.png);
display: inline-block;
}

.newradio 的原因是我使用该 div 作为上面给定 HTML 的父类,我正在正确显示我的 Radios 但未显示已检查状态(图像单选检查),我尝试使用颜色更改代替背景图像,但这也不起作用。

有没有人有在引导程序中自定义单选按钮的经验?请指导

马诺杰·索尼

【问题讨论】:

标签: html twitter-bootstrap css radio-button


【解决方案1】:

您需要找到引导 css 类并覆盖它。或者在 css 中使用 ID 而不是类。如果这也不起作用,请尝试 !important。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-11
    • 2021-04-23
    • 2018-10-08
    • 2012-07-25
    • 1970-01-01
    • 2012-01-07
    • 2014-08-19
    相关资源
    最近更新 更多