英文:
aligning checkboxes with labels
问题
我无法对复选框与其标签进行对齐,它们会浮动到标签的上方,而在移动设备上,它们会位于标签下方。
问题发生在所有复选框上,所以当你选择“Primary school teacher”选项并从下拉菜单中选择“headteacher”时,问题都会发生。
页面链接为https://careermapforprimary.co.uk/#register
我尝试添加一些CSS但没有起作用。
.mc-field-group input[type="checkbox"] {
vertical-align: middle;
}
请问有什么建议吗?
这是创建表单字段的代码,没有包含CSS:
<div id="conditional-fields-primary-teacher" style="display: none;">
<div class="mc-field-group">
<label for="mce-FNAME">名字 <span class="asterisk">*</span></label>
<input type="text" value="" name="FNAME" class="required" id="mce-FNAME" required>
</div>
<div class="mc-field-group">
<label for="mce-LNAME">姓氏 <span class="asterisk">*</span></label>
<input type="text" value="" name="LNAME" class="required" id="mce-LNAME" required>
</div>
<div class="mc-field-group">
<label for="mce-JOB_TITLE">职位 <span class="asterisk">*</span></label>
<input type="text" value="" name="JOB_TITLE" class="required" id="mce-JOB_TITLE" required>
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">电子邮件地址 <span class="asterisk">*</span></label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
</div>
<div class="mc-field-group">
<label for="mce-REGION">地区 <span class="asterisk">*</span></label>
<select name="REGION" class="required" id="mce-REGION" required>
<option value="">选择...</option>
<!-- 其他选项... -->
</select>
</div>
<div class="mc-field-group">
<label>年级/组(选中所有适用项):</label>
<div>
<input type="checkbox" name="year-group" value="Reception" id="mce-reception">
<label for="mce-reception">Reception</label>
</div>
<!-- 其他年级选项... -->
</div>
</div>
希望这对你有所帮助。
英文:
I cant align the checkboxes to their labels, they float one line higher and on mobile they are underneath the label.
The problem happens on all checkboxes, so when you pick the Primary school teacher option and headteacher from the dropdown.
The link to the page is https://careermapforprimary.co.uk/#register
I've tried to add some CSS but it didn't work.
.mc-field-group input[type="checkbox"] {
vertical-align: middle;
}
any suggestions please?
This is the code to create the form fields, there is no css:
<div id="conditional-fields-primary-teacher" style="display: none;">
<div class="mc-field-group">
<label for="mce-FNAME">First name <span class="asterisk">*</span></label>
<input type="text" value="" name="FNAME" class="required" id="mce-FNAME" required>
</div>
<div class="mc-field-group">
<label for="mce-LNAME">Last name <span class="asterisk">*</span></label>
<input type="text" value="" name="LNAME" class="required" id="mce-LNAME" required>
</div>
<div class="mc-field-group">
<label for="mce-JOB_TITLE">Job title <span class="asterisk">*</span></label>
<input type="text" value="" name="JOB_TITLE" class="required" id="mce-JOB_TITLE" required>
</div>
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span></label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
</div>
<div class="mc-field-group">
<label for="mce-REGION">Region <span class="asterisk">*</span></label>
<select name="REGION" class="required" id="mce-REGION" required>
<option value="">Select...</option>
<option value="Bedfordshire">Bedfordshire</option>
<option value="Berkshire">Berkshire</option>
<option value="Bristol">Bristol</option>
<option value="Buckinghamshire">Buckinghamshire</option>
<option value="Cambridgeshire">Cambridgeshire</option>
<option value="Cheshire">Cheshire</option>
<option value="Cornwall">Cornwall</option>
<option value="Cumbria">Cumbria</option>
<option value="Derbyshire">Derbyshire</option>
<option value="Devon">Devon</option>
<option value="Dorset">Dorset</option>
<option value="Durham">Durham</option>
<option value="East Sussex">East Sussex</option>
<option value="Essex">Essex</option>
<option value="Gloucestershire">Gloucestershire</option>
<option value="Greater London">Greater London</option>
<option value="Greater Manchester">Greater Manchester</option>
<option value="Hampshire">Hampshire</option>
<option value="Herefordshire">Herefordshire</option>
<option value="Isle of Wight">Isle of Wight</option>
<option value="Kent">Kent</option>
<option value="Lancashire">Lancashire</option>
<option value="Leicestershire">Leicestershire</option>
<option value="Lincolnshire">Lincolnshire</option>
<option value="Merseyside">Merseyside</option>
<option value="Norfolk">Norfolk</option>
<option value="North Yorkshire">North Yorkshire</option>
<option value="Northamptonshire">Northamptonshire</option>
<option value="Northumberland">Northumberland</option>
<option value="Nottinghamshire">Nottinghamshire</option>
<option value="Oxfordshire">Oxfordshire</option>
<option value="Rutland">Rutland</option>
<option value="Shropshire">Shropshire</option>
<option value="Somerset">Somerset</option>
<option value="South Yorkshire">South Yorkshire</option>
<option value="Staffordshire">Staffordshire</option>
<option value="Suffolk">Suffolk</option>
<option value="Surrey">Surrey</option>
<option value="Tyne and Wear">Tyne and Wear</option>
<option value="Warwickshire">Warwickshire</option>
<option value="West Midlands">West Midlands</option>
<option value="West Sussex">West Sussex</option>
<option value="West Yorkshire">West Yorkshire</option>
<option value="Wiltshire">Wiltshire</option>
<option value="Worcestershire">Worcestershire</option>
</select>
</div>
<div class="mc-field-group">
<label>Year/Group (Tick all that apply):</label>
<div>
<input type="checkbox" name="year-group" value="Reception" id="mce-reception">
<label for="mce-reception">Reception</label>
</div>
<li>
<div>
<input type="checkbox" name="year-group" value="Year 1" id="mce-year1">
<label for="mce-year1">Year 1</label>
</div>
</li>
<div>
<input type="checkbox" name="year-group" value="Year 2" id="mce-year2">
<label for="mce-year2">Year 2</label>
</div>
<div>
<input type="checkbox" name="year-group" value="Year 3" id="mce-year3">
<label for="mce-year3">Year 3</label>
</div>
<div>
<input type="checkbox" name="year-group" value="Year 4" id="mce-year4">
<label for="mce-year4">Year 4</label>
</div>
<div>
<input type="checkbox" name="year-group" value="Year 5" id="mce-year5">
<label for="mce-year5">Year 5</label>
</div>
<div>
<input type="checkbox" name="year-group" value="Year 6" id="mce-year6">
<label for="mce-year6">Year 6</label>
</div>
</div>
</div>
答案1
得分: 1
<div class="input-wraper">
<input class="input" type="checkbox" name="year-group" value="Reception" id="mce-reception">
<label for="mce-reception" style="display: inline-block">Reception</label>
</div>
.input-wraper {
display: flex;
align-items: center;
flex-direction: row-reverse;
margin: 3px 4px 3px 3px;
}
.input {
vertical-align: middle;
margin: 0;
}
英文:
<div class="input-wraper">
<input class="input" type="checkbox" name="year-group" value="Reception" id="mce-reception">
<label for="mce-reception" style="display: inline-block">Reception</label>
</div>
.input-wraper {
display: flex;
align-items: center;
flex-direction: row-reverse;
margin: 3px 4px 3px 3px;
}
.input {
vertical-align: middle;
margin: 0;
}
答案2
得分: 0
尝试移除 width: 100%
并将您的输入和标签设置为 display: inline-block
。
英文:
The problem is here :
#mc_embed_signup .mc-field-group input {
display: block;
width: 100%;
padding: 8px 0;
text-indent: 2%;
}
Try to remove the width: 100% and turn you're input and label on display: inline-block
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论