好的,所以我已经尝试了几个以前的 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/