【问题标题】:Overlaping text with radio buttons in bootstrap col在 bootstrap col 中使用单选按钮重叠文本
【发布时间】:2018-03-03 16:54:25
【问题描述】:

我有一个添加了 .html 的单选按钮。但结果是与单选按钮重叠的文本。

Overlapping Radio buttons with text.

您还可以看到文本向下而不是覆盖所有引导程序 col-4 、 col-4 、 col-4。

function addQAs() {
    randQuestion = Math.floor(Math.random() * library.length); //this is a nuber, dont forget!
    console.log(randQuestion);
    $("#question").html(library[randQuestion].question);
    $("#answer1").html(library[randQuestion].answer[0]);
    $("#answer2").html(library[randQuestion].answer[1]);
    $("#answer3").html(library[randQuestion].answer[2]);
}
<div class="container-fluid">
        <form>
            <div class="row">
                <div class="col-4">
                    <input type="radio" id="answer1" value="answer1" index="0">
                    <label for="answer1"></label>
                </div>
                <div class="col-4">
                    <input type="radio" id="answer2" value="answer2" index="1">
                    <label for="answer2"></label>
                </div>
                <div class="col-4">
                    <input type="radio" id="answer3" value="answer3" index="2">
                    <label for="answer3"></label>
                </div>
            </div>
        </form>
    </div>

我没有为这个问题尝试过任何 CSS。

谢谢

【问题讨论】:

    标签: javascript jquery html css radio-button


    【解决方案1】:

    尝试添加这个 css

    .col-4 {
      position: relative;
    }
    input[type="radio"] {
      position: absolute;
      left: -15px; // set as per your requirement
      top: 5px; // set as per your requirement
    }
    

    【讨论】:

    • 如果此答案解决了您的问题,请考虑通过单击复选标记并投票来接受它。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-29
    • 2015-06-13
    • 2013-05-18
    • 2015-09-08
    • 2014-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多