...

View Full Version : Hiding my work for future use



Limey10
01-15-2010, 03:35 AM
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

Doctor_Varney
01-15-2010, 04:31 AM
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

abduraooft
01-15-2010, 08:45 AM
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.

Excavator
01-15-2010, 09:21 AM
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.

Doctor_Varney
01-15-2010, 05:39 PM
Comment them using <!-- --> tags or enclose them inside a serverside comment.

Even better!
(Why din' I fink o that?)

linehand
01-15-2010, 09:05 PM
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

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

<!--
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).

Limey10
01-17-2010, 06:38 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum