Borders on form-elements

Bert Bos bert at w3.org
Fri Nov 19 14:45:50 GMT 2004


On Thursday 18 November 2004 15:06, Allan Sandfeld Jensen wrote:
> Hi again
>
> I've implemented some quick support for CSS-borders on some
> form-element (textarea, lineedit, filebutton and label). Inorder not
> to lose native "borders" painted by the widget-style. I've introduced
> a new border-type called -khtml-native, which is painted only if set
> on all four borders. When any other border is set, the native border
> is hidden in Qt and a CSS-border painted instead.

That may work, but have you looked at the 'appearance' property of the 
CSS3 UI module? See http://www.w3.org/TR/css3-ui/#system

It looks a bit complicated, as it is partly a shorthand and partly a 
fallback, but in theory, setting something like

    INPUT { appearance: push-button }

in the browser's style sheet should give INPUT the border (and color, 
font and cursor) of a native button, _unless_ the button already has a 
border other than 'none', because of some other rule.

The algorithm for the border style would be something like this:

    if element has 'border-style' <> 'none' then
      use the border properties
    else if element has 'appearance' <> 'normal' then
      draw the native widget indicated by 'appearance'
    else
      draw no border

This changes the old meaning of 'border-style: none' a bit: it now means 
to use the style indicated by 'appearance' instead of simply "no 
border." If you want to force an element to have no border, there is 
still 'border-style: hidden' for that.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert at w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 93 65 76 92            06902 Sophia Antipolis Cedex, France




More information about the kfm-devel mailing list