Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    281
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can div's be hidden

    how can i hide <div>'s???

  • #2
    cfc
    cfc is offline
    Regular Coder
    Join Date
    Dec 2004
    Location
    Keswick, Ontario
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <style type="text/css">
        div {
            display: none;
        }
    </style>
    With even minimal CSS knowledge you should be able to figure out what you need from that

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Be aware though that non-displayed content is not accessible to most browser-based screenreaders. If the div has content, you'd be better to use "offleft positioning" - moving the element off the page so that it's still rendered, and accessible to readers, but with no physical impact on the visual layout:
    Code:
    div.offleft {
        position:absolute;
        left:-10000px;
        }
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Regular Coder
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    281
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <style type="text/css">
        div {
            display: none;
        }
    </style>
    the above hides all divs right? is it possible to hide all the <div>'s except for certain ones??

  • #5
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think:

    Code:
    <style type="text/css">
        div#nav #content #sidebar #whatever #whatever {
            display: none;
        }
    </style>
    You could also try giving the divs a height of 0px and setting the overflow to 'hidden' - though I'm quite new to that particular technique and there may be a bit more to it than that.

    Kind regards,

    Gary

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    What about
    Code:
    visibility:hidden
    ? Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #7
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    visibility: hidden is a no. I think it either doesn't work or only works with certain browsers.

    If you want to hide every div exept one, you could do this:

    div { display: none; }
    div#ThatSpecialDiv { display: block; }
    Shawn

  • #8
    Regular Coder
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    281
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks works perfectly


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •