【问题标题】:Bootstrap Radio button size on firefoxFirefox 上的 Bootstrap 单选按钮大小
【发布时间】:2016-04-01 23:25:08
【问题描述】:

我不明白为什么 Firefox 上的单选按钮比其他浏览器更小。 我在我的项目中使用引导程序。 这是 HTML:

<!DOCTYPE html>
<html lang="en-gb">
  <head>
    <meta charset="UTF-8">
    <title>Example - pure CSS</title>
    <link rel="stylesheet" href="css2.css">
  </head>
  <body>
    <div id="5159" aria-labelledby="5158" checked="false">
        <div class="radio">
            <label>
                <input id="51590" name="5159" onchange="sendInput('5159', this.value)" data-modalfocus="" checked="" value="Yes" type="radio" style="margin-top: 1px;">
                Yes
            </label>
        </div>
        <div class="radio">
            <label>
                <input id="51591" name="5159" onchange="sendInput('5159', this.value)" data-modalfocus="" value="No" type="radio" style="margin-top: 1px;">
                No
            </label>
        </div>
    </div>
</body>
</html>

还有 CSS:

.radio {
  /*margin: 8px 0px 10px 0px; */}

.radio + .radio {
  margin-top: 0px; }

.radio label {
  line-height: 16px;
  min-height: 16px;
  color: #222222;
  font-size: 14px;
  margin-left: 4px; }

.radio input[type='radio'] {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  outline: none;
  box-shadow: 0 0 1px 0px #999999 inset;
  }
  .radio input[type='radio']:hover {
    box-shadow: 0 0 1px 0px #999999 inset; }
  .radio input[type='radio']:before {
    content: '';
    display: block;
    width: 40%;
    height: 40%;
    margin: 30% auto;
    border-radius: 50%; }
  .radio input[type='radio']:checked:before {
    background: #666666; }
  .radio input[type='radio']:focus {
    border: 1px solid #4276f2 !important; }
  .radio input[type='radio']:disabled {
    box-shadow: 0 0 1px 0px #CCCCCC inset;
    background: #CCCCCC;
    color: #999999; }

在 Chrome 和 IE 上一切正常,但 Firefox 似乎将单选按钮的大小限制为 13x13 像素,无论输入的宽度和高度有多大。

【问题讨论】:

    标签: html css


    【解决方案1】:

    对于 Firefox 来说有点不同。您需要添加 -moz-appearance: none;到你的 CSS 让它工作:

    input {
    z-index: 3;
    width: 26px;
    height: 26px;-moz-appearance: none;}
    

    我这里做了一个例子:https://jsfiddle.net/mickey_dt/5762q39m/2/

    希望对您有所帮助。

    【讨论】:

    猜你喜欢
    • 2019-12-18
    • 2018-10-12
    • 2013-03-05
    • 2019-01-18
    • 2014-07-03
    • 2011-09-01
    • 2014-05-14
    • 1970-01-01
    相关资源
    最近更新 更多