6

Metacity: Specifying button widths in CSS

view full story
linux-howto

http://blogs.gnome.org – The height of a button in a CSS theme is determined by the height of the titlebar, which in turn is determined in most cases by the height of the titlebar font, but occasionally explicitly.  The height of buttons cannot be set explicitly. For the width of the button, however, there are two common cases: The artist wants it to be a specified number of pixels, millimetres, ems, etc. Much more often, the artist wants it to be a specified multiple of the button’s height, often 1:1. There has been some controversy about how we should represent this in CSS: In the first draft of the themes specification, the width and height properties could be set on a button, but were only used to calculate the ratio.  Explicit widths could be set using max-width and min-width.  Screwtape called this abuse of the semantics “a bit cruel”. We could honour width directly for absolute values, but then there comes the question of how to handle ratios.  If you set the width to a percentage, we could use that, but traditionally that has meant a percentage of the width of the enclosing element, not of the height.  We could make an exception in this case, of course. The universal solution of width: -cowbell-button-ratio(0.25), or whatever, which is ugly. Or alternatively allow width to be set directly for absolute widths, and as an alternative have -cowbell-width-ratio: 0.25. Invent a new unit!  width: 0.25ht.  This idea should probably be avoided. Your chronicler is stumped as to the solution which would be clearest to theme artists.  Gentle reader, do you have a suggestion? (Software)