One of the weaker points of the various Gecko browsers, and particularly noticeable on OS X, is the rather poor appareance of form widgets (input fields, submit buttons, textareas and others. Luckily, those are, like almost everything, styled with CSS, and can then can be improved by using the user style sheet (userContent.css, found in the profile folder). Jon Hicks opened the discussion on the subject a few days ago. In a follow up post, he offered some native looking submit buttons. While those are very nice looking, they suffer from one small problem: the buttons are fixed in size, based on one background image. If the text inside the button overflows the size of the image, it becomes rather poor looking.
Weaponed with the DOM inspector, and reading through the forms.css stylesheet (which controls the styling of form widgets in Gecko browsers), we found one pseudo-element that might provide an additional style hook:
*|*::-moz-button-content {}This pesudo-element appears to control the inner line-box of submit widgets. Using some ‘sliding door’ technique, padding and background images would allow to build flexible buttons. Ideally, we would use the ::before and ::after pseudo-elements, but this doesn’t work on replaced elements in Gecko (see bug 169334). Anyway. Through some trial and error, we did manage to build some decent looking native OS X buttons. After testing we did notice some problems however. The buttons still suffered from a fixed height (problematic when one need to resize the text on some sites. Additionally, upon clicking on some links, a weird little widget would pop up at the top of the window, which would then crash the browser. We’ll have to check out the XUL references to find out what exactly that pseudo element does.
Back to the drawning board. In the end, we settled for a simple background image, and the use of rounded corners via the -moz-border-radius proprietary extension to style the buttons.

Improved submit buttons for Firefox.
The top image shows the ‘publish button’ in the Textpattern interface, the bottom image shows the submit button bellow the comments forms on Jon Hicks blog. Not yet really native, but a decent enhancement to the default widgets in Firefox anyway. The input widgets are styled as follows:
button, input[type="reset"], input[type="button"], input[type="submit"] {
background-color: #e1e4e7 !important;
background-image: url(aguaButton.png) !important;
background-repeat: repeat-x !important;
background-position: 50% 50% !important;
color:#101011 !important;
-moz-border-radius: .45em;
padding: .07em .25em !important;
border: 1px solid #c1c6cb !important;
border-bottom: 2px solid #8c9298 !important;
font-size:12px !important;
width:auto !important;
height:auto !important;
}Most everything is set to !important to override whatever a site might have decided about styling those widgets.
Commenting is closed for this article. If you have anything to share, feel free to contact us.
More information about these options for style and layout.
Comment by: Anne — 20.08 2004 - 08:43 UTC+9 [ # ]
Comment by: Philippe — 20.08 2004 - 10:29 UTC+9 [ # ]