Re: Toggling visibility in css, not javascript

Discussion in 'HTML' started by C A Upsdell, Aug 4, 2008.

  1. C A Upsdell

    C A Upsdell Guest

    Chris wrote:
    > Is there a way that I can toggle the visibility of a div on and off
    > using css alone? It's a bit inconvenient in our app to use javascript here.


    Yes, using hover. But it does not work with IE6 and earlier: for these
    browsers you have to add a bit of JavaScript, which results in a
    solution which is not pure CSS.
    C A Upsdell, Aug 4, 2008
    #1
    1. Advertising

  2. C A Upsdell

    Bergamot Guest

    C A Upsdell wrote:
    > Chris wrote:
    >> Is there a way that I can toggle the visibility of a div on and off
    >> using css alone? It's a bit inconvenient in our app to use javascript here.

    >
    > Yes, using hover. But it does not work with IE6 and earlier


    I believe Safari is also an odd man out where it comes to detecting
    state. It doesn't seem to have a problem with :hover, but IIRC :active
    and/or :focus require the user to keep the mouse button down for the
    duration. Simulating mouse events like onclick isn't really do-able.

    > for these
    > browsers you have to add a bit of JavaScript, which results in a
    > solution which is not pure CSS.


    You'll need JS for Safari, too.

    --
    Berg
    Bergamot, Aug 4, 2008
    #2
    1. Advertising

  3. C A Upsdell

    C A Upsdell Guest

    Chris wrote:
    > C A Upsdell wrote:
    >> Chris wrote:
    >>> Is there a way that I can toggle the visibility of a div on and off
    >>> using css alone? It's a bit inconvenient in our app to use javascript
    >>> here.

    >>
    >> Yes, using hover. But it does not work with IE6 and earlier: for
    >> these browsers you have to add a bit of JavaScript, which results in a
    >> solution which is not pure CSS.
    >>

    > I'd prefer to have the user click a control, have the <div> open, and
    > then be able to click it again to close.


    That you cannot do with CSS.
    C A Upsdell, Aug 5, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2lhag==?=

    Toggling Image

    =?Utf-8?B?c2lhag==?=, May 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    425
    =?Utf-8?B?U2hhbmU=?=
    May 6, 2005
  2. Replies:
    1
    Views:
    387
    jasonkester
    Jul 7, 2005
  3. cwdjrxyz
    Replies:
    1
    Views:
    767
    cwdjrxyz
    Aug 5, 2008
  4. richard
    Replies:
    3
    Views:
    488
    cwdjrxyz
    Aug 6, 2008
  5. Machi
    Replies:
    1
    Views:
    333
    Ray at
    Apr 15, 2004
Loading...

Share This Page