ToggleButton
的背景突出其底部边框。
谁能告诉我我做错了什么?
我在 SceneBuilder 中为 ToggleButton
设置了 id。
CSS:
#blue-unselected {
-fx-border-color: #26b4d5;
-fx-border-radius: 4;
-fx-background-color: white;
-fx-background-radius: 4;
-fx-font-size:14;
-fx-text-fill: #26b4d5;
-fx-font-family: "Verdana Pro Cond SemiBold"
}
最佳答案
只需添加以下属性:
-fx-background-insets: 0;
.toggle-button
的默认属性值(在 modena.css 中)定义为:
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
您对这个值的第一部分 (0 0 -1 0
) 很感兴趣,因为您定义了一个单一的背景颜色。这种颜色将有一个 -1
底部插入(四个值是 [top, right, bottom, left]),这导致底部有 1 个像素突出。
关于java - ToggleButton 的背景伸出其边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42578243/