Wicket 小门支票箱

Wicket 小门支票箱,wicket,Wicket,如何更改checkboxmultipleechoice的呈现html的css样式?默认情况下,CheckBoxMultipleChoice呈现此html输出,但我想更改此呈现输出的css样式 <div class="ca-info__cat-roles js-roles-1 expanded" wicket:id="categories" id="categoriesb"> <input name="categories" type="checkbox" value="

如何更改checkboxmultipleechoice的呈现html的css样式?默认情况下,CheckBoxMultipleChoice呈现此html输出,但我想更改此呈现输出的css样式

<div class="ca-info__cat-roles js-roles-1 expanded" wicket:id="categories" id="categoriesb">
    <input name="categories" type="checkbox" value="819" id="categoriesb categories_819">
    <label for="categoriesb-categories_819">index&gt;root&gt;CategoryCatalog.png&gt;9</label>
    <input name="categories" type="checkbox" value="829" id="categoriesb-categories_829">
    <label for="categoriesb-categories_829">index&gt;root&gt;tv.png&gt;9</label>
</div>

indexrootCategoryCatalog.png9
indexroottv.png9

我想更改输入和标签的样式,但我不知道如何使用CheckboxMultipleEchoice进行更改。

我已经这样做了。有两种方法

  • 在html页面本身中添加CSS。在
    style
    标签中添加您的样式,如下所示,但如果您有相同的样式,这将影响其他组件

    .ca-info__cat-roles js-roles-1.expanded label{
        // Your style for label
     }       
    .ca-info__cat-roles js-roles-1.expanded input{
        // Your style for input 
     }
    

  • 2.另一种方法是,您可以为复选框(例如,
    buffer.append(“class=\”yourStyleclass\”)创建和派生自己的样式

    除了为组件使用自定义css,还必须使用setSuffix()和setPrefix()方法,如下所示:

    checkboxes = new CheckBoxMultipleChoice<>("checkboxes", value);
    checkboxes.setSuffix("<br/>");
    
    checkboxes=新的checkboxmultipleechoice(“checkboxes”,值);
    复选框。setSuffix(“
    ”);