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 7 of 7
  1. #1
    New Coder Limey10's Avatar
    Join Date
    Sep 2009
    Location
    Malaysia
    Posts
    54
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Hiding my work for future use

    Hi all,

    I have a page with a few divs (populated with various text and images) that i would like to hide or mask away for future use so that i don't have to delete and then re-invent it.

    I didn't include the code because it's nothing specific.

    Is there a simple way of doing this?

    Thanks as always, Phil
    "I'm still smiling because they haven't found the bodies yet.....muhahaha (evil laugh)"
    GrammarProofing

  • #2
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Quote Originally Posted by Limey10 View Post
    Is there a simple way of doing this?
    Yes. In your CSS, you can use 'visibility:hidden;' when you want to hide an element and then you can use 'visibility:visible;' to unhide it again. Or you can just delete the line, when you no longer need it.

    Here are the official instructions on it's use.
    http://www.w3schools.com/CSS/pr_class_visibility.asp

    Hope this helps

    Dr. V
    Last edited by Doctor_Varney; 01-15-2010 at 05:13 AM.
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I have a page with a few divs (populated with various text and images) that i would like to hide or mask away for future use so that i don't have to delete and then re-invent it.
    Comment them using <!-- --> tags or enclose them inside a serverside comment.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Limey10 (01-17-2010)

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello Limey10,
    I've got different stages of development going on all the time. I upload the live version but save v.2, v.2.x, v.2.xx here locally - along with a backup of the live version for just in case.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Quote Originally Posted by abduraooft View Post
    Comment them using <!-- --> tags or enclose them inside a serverside comment.
    Even better!
    (Why din' I fink o that?)
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #6
    Regular Coder
    Join Date
    Nov 2009
    Posts
    110
    Thanks
    7
    Thanked 9 Times in 9 Posts
    Also, visibility:hidden; will still cause the browser to DL the content (including any images or other assets). display:none; generally won't DL the content in most (all?) browsers.

    comments (<!-- -->) would work too but it depends on what you are doing. The advantage to the comments would be that you can potentially comment out a large section of code with multiple elements in one go. Though in practice there may be minor complications, like having other actual comments within the section of code to be commented out might require some additional opening and closing comment tags.

    So too hide this
    Code:
    a bunch of code <!-- this code does this -->
    a bunch more code <!-- this code does something else -->
    you would need more than one extra comment due to the 'real' comments, like this
    Code:
    <!--
    a bunch of code--> <!-- this code does this --><!--
    a bunch more code --><!-- this code does something else -->
    so it could get a little sloppy depending on the situation. Certainly commenting out code is a valid and useful thing, but I use it more for the short term during development.


    Personally, for long term disabling of fully working code, I would probably use display:none;. It won't DL the content and can be tweaked easily just through CSS without going back and editing your HTML. It can be applied to a single parent container and it will effect all children/descendants. So it could be set up so that changing a single CSS value applied to a wrapper could activate/deactivate a whole section (alternatively you could just have a single class for display:none; and then just apply/remove that in the html as needed).

  • #7
    New Coder Limey10's Avatar
    Join Date
    Sep 2009
    Location
    Malaysia
    Posts
    54
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks all for the great answers.

    I think i'm going to comment the code out as it is definitely the easiest and will stand out when i need to un-comment it. If i save different versions of my site, it will get very messy for me and to use the visibility:hidden idea, i will forget and be back here again asking the forum "why doesn't my code show up".

    Thanks again, Phil
    "I'm still smiling because they haven't found the bodies yet.....muhahaha (evil laugh)"
    GrammarProofing


  •  

    Posting Permissions

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