您如何使标签文本显示在无线电输入上方?
由于某种原因,当我尝试执行标签>
您每周玩几次?< label
就在我的无线电输入上方,标签中的文本没有出现。当我在任何其他地方尝试它时,例如在无线电输入的末尾使用它。它仅在收音机输入之前就不起作用。
.bcontainer {
height: 800px;
width: 550px;
background-color: rgba(245, 245, 220, .95);
margin-left: auto;
margin-right: auto;
border-radius: 5px;
margin-bottom: 15px;
margin-top: 15px;
border: 2.5px solid black;
}
label {
display: block;
margin: 15px;
color: black;
font-family: verdana;
}
fieldset {
margin: 0;
padding: 0;
border: 0;
}
input {
width: 100%;
margin-top: 10px;
color: white;
background-color: black;
border: 1px solid black;
min-height: 2em;
}
}
.align {
vertical-align: middle;
width: unset;
margin: 0 10px 0 0;
}
<div class="hcontainer">
<h1 id="title">Game Type Survey</h1>
<p id="description"><em>Thank you for your response!</em></p>
</div>
<div class="bcontainer">
<form id="survey-form" action="https://register-demo.freecodecamp.org">
<fieldset>
<label id="name-label">Username: <input type="text" name="username" id="name" placeholder="username" required>
</label>
<label id="email-label">Email: <input id="email" type="email" name="address" placeholder="email" required>
</label>
<label id="number-label">Age: <input id="number" type="number" min="21" max="120" name="age" placeholder="21">
</label>
<label>Which Wallet Do You Use? <select name="wallet" id="dropdown" required>
<option value="">Select Wallet</option>
<option value="1">MetaMask</option>
<option value="2">Coinbase</option>
<option value="3">Wallet Connect</option>
</fieldset>
<fieldset>
<label>How Many Times do you Play Per Week?</label>
<label><input type="radio" name="#oftimes" class="align" value="1">0-1</label>
<label><input type="radio" name="#oftimes" class="align" value="2">2-7</label>
<label><input type="radio" name="#oftimes" class="align" value="3">8+</label>
For some reason when I try to do label>
How Many Times do you Play Per Week?<label
right above my radio inputs, the text from the label doesn't show up. When I try it in any other place such as at the end of the radio inputs it works. It only doesn't work before the radio inputs.
.bcontainer {
height: 800px;
width: 550px;
background-color: rgba(245, 245, 220, .95);
margin-left: auto;
margin-right: auto;
border-radius: 5px;
margin-bottom: 15px;
margin-top: 15px;
border: 2.5px solid black;
}
label {
display: block;
margin: 15px;
color: black;
font-family: verdana;
}
fieldset {
margin: 0;
padding: 0;
border: 0;
}
input {
width: 100%;
margin-top: 10px;
color: white;
background-color: black;
border: 1px solid black;
min-height: 2em;
}
}
.align {
vertical-align: middle;
width: unset;
margin: 0 10px 0 0;
}
<div class="hcontainer">
<h1 id="title">Game Type Survey</h1>
<p id="description"><em>Thank you for your response!</em></p>
</div>
<div class="bcontainer">
<form id="survey-form" action="https://register-demo.freecodecamp.org">
<fieldset>
<label id="name-label">Username: <input type="text" name="username" id="name" placeholder="username" required>
</label>
<label id="email-label">Email: <input id="email" type="email" name="address" placeholder="email" required>
</label>
<label id="number-label">Age: <input id="number" type="number" min="21" max="120" name="age" placeholder="21">
</label>
<label>Which Wallet Do You Use? <select name="wallet" id="dropdown" required>
<option value="">Select Wallet</option>
<option value="1">MetaMask</option>
<option value="2">Coinbase</option>
<option value="3">Wallet Connect</option>
</fieldset>
<fieldset>
<label>How Many Times do you Play Per Week?</label>
<label><input type="radio" name="#oftimes" class="align" value="1">0-1</label>
<label><input type="radio" name="#oftimes" class="align" value="2">2-7</label>
<label><input type="radio" name="#oftimes" class="align" value="3">8+</label>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尚未关闭
&lt; label&gt;
和&lt; select
elements之前。关闭这些,它应该有效,这样:我建议您在选择的代码编辑器上查找如何“自动识别”,或者以其他方式保持完美的凹痕,因为这样的问题真的很容易发现,并且避免了正确的缩进量的缩进:)使一切变得更加整洁,更易于使用!
You haven't closed both the
<label>
and<select>
elements before it. Close those and it should work, like this:I recommend finding out how to 'auto-indent' on your code editor of choice, or otherwise get in the habit of keeping perfect indentation, as issues like these are really easy to spot and avoid when the code is indented correctly :) It also makes everything a lot tidier and easier to work with!