gpt4 book ai didi

html - 将字段集中的复选框拆分为两列

转载 作者:行者123 更新时间:2023-11-28 02:03:25 25 4
gpt4 key购买 nike

我正在尝试使用 CSS 将同一字段集中的复选框拆分为两列。

例如我的代码如下:

<div id="topicsbox">
<label class="topicsname">Topics*</label>
<label class="description">Select topic areas for which you would like to receive future updates from CTU (articles, blog posts, white papers, etc.). Check all that apply:</label>
<div id="topicsmessage" class="messagebox"></div>

<fieldset>
<input type="checkbox" name="topics[]" id="AllTopStories" value="1098375" /><label for="AllTopStories">All Top Stories</label>
<input type="checkbox" name="topics[]" id="BusinessandManagement" value="1098376" /><label for="BusinessandManagement">Business and Management</label>
<input type="checkbox" name="topics[]" id="CareerandProfessional" value="1098377" /><label for="CareerandProfessional">Career and Professional</label>
<input type="checkbox" name="topics[]" id="CriminalJustice" value="1098378" /><label for="CriminalJustice">Criminal Justice</label>
<input type="checkbox" name="topics[]" id="HealthcareAdministration" value="1098379" /><label for="HealthcareAdministration">Healthcare Administration</label>
<input type="checkbox" name="topics[]" id="HomelandSecurity" value="1098380" /><label for="HomelandSecurity">Homeland Security</label>
<input type="checkbox" name="topics[]" id="ITEngineeringComputerScience" value="1098381" /><label for="ITEngineeringComputerScience">IT, Engineering, Computer Science</label>
</fieldset>
</div>

有谁知道将此列表拆分为左侧 4 个输入复选框和右侧 3 个输入复选框的正确 CSS?

最佳答案

如何设置输入和标签的 css 如下:

  • 设置合适的宽度
  • 设置显示:内联 block

这样你就不需要一个清晰的 div,如果只是 float 它们,你将需要它

你也可以选择 CSS3 解决方案

-moz-column-count:2; /* Firefox */
-webkit-column-count:2; /* Safari and Chrome */
column-count:2;

关于html - 将字段集中的复选框拆分为两列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12877336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com