gpt4 book ai didi

java - Wicket::如何在 CheckBoxMultipleChoice 的复选框中添加样式边距

转载 作者:行者123 更新时间:2023-11-29 05:23:45 25 4
gpt4 key购买 nike

我将列表传递给 CheckBoxMultipleChoice 并使用 apache wicket 在前端生成复选框

我想在所有复选框之间添加边距。

我的代码如下:

HTML代码

<div wicket:id="leasedLineChildChkLeft" style="width: 50%; float: right;"></div>

Java代码

 final CheckBoxMultipleChoice<Integer> leasedLineChildDivLeft = new CheckBoxMultipleChoice<Integer>("leasedLineChildChkLeft", new Model(llSpeedSelectLeft), llSpeedListLeft);

在前端生成的结果动态 html

    <div class="metaCommentListStyle" style="width: 50%; float: left;" wicket:id="leasedLineChildChkLeft"><input type="checkbox" id="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_0" value="0" name="commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft"><label for="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_0">1</label><br>
<input type="checkbox" id="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_1" value="1" name="commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft"><label for="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_1">2</label><br>
<input type="checkbox" id="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_2" value="2" name="commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft"><label for="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_2">3</label><br>
<input type="checkbox" id="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_3" value="3" name="commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft"><label for="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_3">4</label><br>
<input type="checkbox" id="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_4" value="4" name="commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft"><label for="leasedLineChildChkLeft67-commentChoiceDiv:leasedLineDiv:leasedLineChildDiv:0:leasedLineChildChkLeft_4">5</label><br>
</div>

我试过了

leasedLineChildDivLeft.add(new SimpleAttributeModifier("class", "metaCommentListStyle"));

但结果它会将类添加到 div 元素而不是复选框

如何在复选框之间添加边距?

最佳答案

使用 CSS 子选择器设置您的输入样式:

div.metaCommentListStyle input {
margin-left: 4px;
}

如果您需要对标记进行更多控制,请改用 CheckGroup/Check。

关于java - Wicket::如何在 CheckBoxMultipleChoice 的复选框中添加样式边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23566909/

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