html - radio 输入间距异常

标签 html css

好的,所以我已经尝试了几个以前的 SO 答案,但仍然没有运气

Radio buttons and label to display in same line

Documentation on <FIELDSET> <LABEL> tags instead of using TABLE's?

Keep radio buttons with their labels on line breaks

发生了一些奇怪的事情,迫使我的 radio 出现一些异常行为。对于我可以做些什么来解决这个问题,我将不胜感激!感谢您的帮助。

现场演示:http://iam.colum.edu/students/jordan.max/web-template(2)/index.html

main.html

<div id="container">

    <form action="welcome_get.php" method="get">
        <p class="textHeader"><strong> First Name </strong></p>
        <input name="firstname" type="text" oninvalid="invalidFName(this);" oninput="invalidFName(this);" placeholder="First Name" required />

        <p class="textHeader"><strong> Last Name </strong></p>
        <p> </p>
        <input id="lastName" type="text" oninvalid="invalidLName(this);" oninput="invalidLName(this);" name="lastName" placeholder="Last Name" required />

        <p class="textHeader"><strong> Email </strong></p>
        <input id="emailaddress" type="email" oninvalid="invalidEmail(this);" name="emailaddress" placeholder="anything@example.com"  required />

        <fieldset>
            <div class="some-class">
                <input type="radio" class="radio" name="x" value="y" id="y" />
                <label for="y">Thing 1</label>
                <input type="radio" class="radio" name="x" value="z" id="z" />
                <label for="z">Thing 2</label>
            </div>
        </fieldset>

        <input type="submit" value="Submit" id="submitButton" />

    </form>

</div>

CSS

最佳答案

您的样式表中包含以下内容:

#container input, #container select, #container textarea {
    width: 450px;
    border: 1px solid #CEE1E8;
    margin-bottom: 20px;
    padding: 4px;
}

width: 450px; 会破坏您的 radio 场布局。您可以尝试在该语句之后添加类似这样的内容以覆盖 radio :

#container input[type=radio] {
    width: auto;
}

关于html - radio 输入间距异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22393509/

相关文章:

javascript - 从 CDN 加载时 Foundation JavaScript 出现问题

html - 如何使按钮居中

javascript - 应该每秒重复一次的函数立即发生

javascript - 如何禁用提交,直到仅填写必填字段

html - 为所有浏览器和 Windows/OSX 设置 <select> <option> 下拉框的样式 css

css - 媒体查询在我的 HTML 代码中不起作用,不确定我在这里做错了什么

html - Internet Explorer (IE11) 忽略 CSS 内嵌 : avoid

html - 为什么我的文本溢出 : ellipsis; did't work?

css - 如何让DIV吸收空间

html - CSS 按钮类断开链接