哪些GTK +元素支持哪些CSS属性? [英] Which GTK+ elements support which CSS properties?
问题描述
当我将自己的CSS应用到我的GTK +应用程序时,我注意到一些元素忽略了一些CSS属性,而其他元素忽略了其他元素或者不忽略它们,这导致我搜索哪些元素支持哪些CSS属性。
例如 Gtk .Label
根本不支持 border
,我不得不放置 Gtk.Frame
>围绕它并在CSS文件中设置样式。另一个问题是,即使是 Gtk.Frame
也不支持 margin
,我想使用它。
任何人都可以给我一些指示,告诉我在哪里可以找到它?
(或者如果我误解了所有这些,我该如何让这些元素支持CSS属性?)
这里是GTK 3.8支持哪些CSS属性的概述。相同的信息主要包含在 GtkCssProvider
,尽管不是表格形式。
哪些小部件支持哪些属性有点困难。它归结为两种小部件:那些简单且只支持基本样式(无边框或背景)的小部件,例如 GtkLabel
;以及那些支持所有属性的文件,比如 GtkFrame
。如你所发现的,在 GtkFrame
或 GtkEventBox
中包装一个简单的小部件是将一个小部件变成其他。
GTK 3.20中的更新:大多数或所有小部件现在都支持 While applying my own CSS to my GTK+ application, I noticed, that some elements ignore some CSS properties and others ignore others or don't ignore them, which leads me to search for an overview of which elements support which CSS properties. So far I couldn't find any such overview. For example Can anyone give me some direction on where to find that?
(Or if I am mistaken with all of this, how do I make the elements support CSS properties?) Here is an overview of which CSS properties are supported as of GTK 3.8. The same information is mostly contained in the documentation for Which widgets support which properties is a bit harder. It boils down to two kinds of widgets: those that are simple and only support basic styling (no borders or backgrounds), such as The Update in GTK 3.20: The 这篇关于哪些GTK +元素支持哪些CSS属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
margin
CSS属性。Gtk.Label
doesn't support border
at all, I had to put a Gtk.Frame
around it and style that in the CSS file. Another issue is, that even a Gtk.Frame
doesn't support margin
, which I want to use.GtkCssProvider
, albeit not in table form.GtkLabel
; and those that support all properties, such as GtkFrame
. Wrapping a simple widget inside a GtkFrame
or GtkEventBox
, as you have discovered, is the usual way to turn one into the other.margin
property is not supported at all, and I'm told that this is a choice by the GTK developers. The thinking goes, as I understand it, that GTK is not HTML, and the layout of your widgets on screen should be governed by your code and not by CSS.margin
CSS property is now supported across most or all widgets.