css help

  • Started
  • Last post
  • 3 Responses
  • vsc

    hello&goodnight. i'm using onfocus="this.blur()" but would rather do it in css. anyone remembers the css property to prevent the dotted box from appearing? thanks.

  • jevad0

    Event handler attributes such as OnFocus and OnBlur are completely external to CSS. They are HTML attributes, which are used to create a potential association with some program code in some scripting language. There's no CSS involved - except in the remote sense that the scripting code may, perhaps, operate on things that correspond, via the
    Document Object Model, some CSS properties.

    However, there _is_ something ín CSS that corresponds to OnFocus and OnBlur in some sense, namely the :focus pseudo-class. But note that :focus is not supported by IE.

    When an element is focused on (and it is browser-dependent what this really means), then, by CSS specifications, it enters the :focus
    pseudo-class. And it leaves that pseudo-class when it loses focus.
    Thus, you can create nice effects, on supporting browsers, using fairly simple CSS constructs like

    input:focus { background: #ffd; color: black; }

  • vsc0

    ah! thanks jevad! googleing (how do you spell this shit?) your keywords just came across a fine cross-browser property:

    { outline: none; }

  • jevad0

    word