开发者

How to make a drop down list control display some items in bold using Struts

Can anyone please help me in making only few items out of all in a combo as bold usin开发者_开发技巧g struts.


To make some options in a select different than the others, you need to apply a different style or CSS class to them. Here is a simple example:

<select>
    <option value="1">1111111111111</option>
    <option class="thisIsDifferent" value="2">2222222222222</option>
    <option class="thisIsDifferent" value="3">3333333333333</option>
    <option value="4">4444444444444</option>
    <option value="5">5555555555555</option>
</select>

This is simple, but the fact is, it does not work cross browser.

Internet Explorer (off course) is limited in what you can apply on the options, so for example a class like:

option.thisIsDifferent {
    font-weight: bold;
    color: red;
}

will make the options bold and red at the same time in Mozilla, but for IE the bold won't work, just the red (I noticed Chrome doing the same thing :().

So maybe, instead of bold you make them a distinguishable color instead?

To add the style on the class using Struts, there is an attribute called styleClass on the <html:option> tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜