我目前正在学习html / css,并希望开发我的第一个网络表单。但是,我在将相关标签放在相关标签旁边时遇到问题。
这是我的jsfiddle
我假设我必须在我的CSS中创建一个.radio样式。但是,我不确定该怎么做。
<form id="contactform" class="rounded" method="post" action="">
<h3>Equipment Procurement Form</h3>
<p>Use this form to submit requests to Medical Physics for new equipment</p>
<div class="field">
<label for="Directorate">Directorate</label>
<input type="text" class="input" name="Directorate" id="Directorate" />
<p class="hint">Enter your directorate.</p>
</div>
<div class="field">
<label for="Department">Department:</label>
<input type="text" class="input" name="Department" id="Department" />
<p class="hint">Enter your department.</p>
</div>
<div class="field">
<label for="Request">Equipment Requested:</label>
<textarea class="input textarea" name="Request" id="Request"></textarea>
<p class="hint">Summarise equipment request..</p>
</div>
<div class="radio">
<input id="Capital" type="radio" name="Capital" value="Capital">
<label for="Capital">Capital
<span class="small">>£5000 (inc VAT)</span></label>
<input id="Capital" type="radio" name="Capital" value="Revenue">
<label for="Capital">Revenue
<span class="small"><£5000 (inc VAT)</span></label>
</div>
<input type="submit" name="Submit" class="button" value="Submit" />
</form>
答案 0 :(得分:2)
请参阅此http://jsfiddle.net/3sPNH/13/。我希望这就是你想要的。只需将input
放在里面。
答案 1 :(得分:1)
<form id="contactform" class="rounded" method="post" action="">
<h3>Equipment Procurement Form</h3>
<p>Use this form to submit requests to Medical Physics for new equipment</p>
<div class="field">
<label for="Directorate">Directorate</label>
<input type="text" class="input" name="Directorate" id="Directorate" />
<p class="hint">Enter your directorate.</p>
</div>
<div class="field">
<label for="Department">Department:</label>
<input type="text" class="input" name="Department" id="Department" />
<p class="hint">Enter your department.</p>
</div>
<div class="field">
<label for="Request">Equipment Requested:</label>
<textarea class="input textarea" name="Request" id="Request"></textarea>
<p class="hint">Summarise equipment request..</p>
</div>
<div class="radio">
<label><input id="Capital" type="radio" name="Capital" value="Capital">
Capital
<span class="small">>£5000 (inc VAT)</span></label>
<label>
<input id="Capital" type="radio" name="Capital" value="Revenue">
Revenue
<span class="small"><£5000 (inc VAT)</span></label>
</div>
<input type="submit" name="Submit" class="button" value="Submit" />
答案 2 :(得分:1)
您将单选按钮放在标签之外,如果将它们放入,它会将它们固定在一起。
<div class="radio">
<label for="Capital">Capital
<input id="Capital" type="radio" name="Capital" value="Capital">
<span class="small">>£5000 (inc VAT)</span></label>
<label for="Capital">Revenue
<input id="Capital" type="radio" name="Capital" value="Revenue">
<span class="small"><£5000 (inc VAT)</span></label>
</div>