简体   繁体   English

在JavaFX中使用默认Modena样式的按钮宽度

[英]The width of button using default modena styles in JavaFX

Take a look at the following image: 看一下下面的图片:

在此处输入图片说明

There are two elements on it - Button and Label with the same text. 上面有两个元素- Button和带有相同文本的Label

Button has width 54 px , lable has width 36 px . 按钮的宽度为54 px ,标签的宽度为36 px The difference is: 54px - 36px = 18px . 区别是: 54px - 36px = 18px

I've studied modena.css but still can't understand where these 18px come from. 我已经研究过modena.css but仍然不知道这18px来自何处。

Could anyone explain? 谁能解释?

In the current version of modena.css , line 420, button has padding defined by 当前版本的modena.css的第420行中,按钮具有由以下内容定义的填充:

-fx-padding: 0.333333em 0.666667em 0.333333em 0.666667em; /* 4 8 4 8 */

On windows, 0.6666667em is 8 pixels, on a Mac it is slightly more, so that padding on the left and right sides accounts for the difference in width. 在Windows上, 0.6666667em是8像素,在Mac上,则稍高一些,因此左侧和右侧的填充说明了宽度的差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM