You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Vaadin Select组件的弹窗设置专属样式

解决Vaadin Select特定组件弹窗样式问题

你设置的search-bar_popup类名是添加在弹窗的容器(<vaadin-select-overlay>)上,而非直接加在<vaadin-select-item>上,所以之前的选择器无法匹配到目标元素。正确的CSS写法是通过弹窗容器的类名定位内部的选项:

vaadin-select-overlay.search-bar_popup vaadin-select-item {
    background: black;
    color: white;
}

如果需要调整弹窗容器本身的样式(比如背景、边框),可以直接针对容器类名设置:

vaadin-select-overlay.search-bar_popup {
    border: 1px solid #ddd;
    background: #111;
}

你的Java代码无需修改,setOverlayClassName是给弹窗容器添加类名的正确方式。

内容的提问来源于stack exchange,提问作者Brett Sutton

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 04:32:34