English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

In general, if i wanted to hide a section or a box on a webpage, what code should i be putting in? since i dont know much html, i only know some basic tags.

2007-07-23 04:57:49 · 6 answers · asked by Alucard 2 in Computers & Internet Programming & Design

6 answers

Use CSS. Specifically, the display property. For example, to hide a table it would look like:



Your Page






Hi!




You can also use the visibility property in a similar way. Basically, hiding it with the display property will hide it on the page completely. Using the visibility property will hide it on the page but leave a blank area (placeholder) equal in size to the thing you're hiding.

2007-07-23 05:04:53 · answer #1 · answered by Chad 5 · 0 0

This is a bit more complicated then you may think...

to do this, you'll need to use Cascading Style Sheets (CSS) to do this. For a tutorial, check out www.w3schools.org

You say you're a beginner so I'm going to explain everything I can without expecting you to know anything:

Tags have attributes... Example:

This text is red

color is an attribute, it holds the value of "red"

In CSS, you need to add a style attribute. Example:

This text is in a green square that is 100 pixels by 100 pixels


To make something hidden, then the style attribute would say:

style="visibility:hidden;"

I'm not giving an exhaustive explaination and you may be confused so look at the tutorials I mentioned above.

2007-07-23 12:10:19 · answer #2 · answered by coreyog 3 · 0 0

If you don't want it to display at all, put after it.

If you simply don't want the border around the box, put border="0" inside the tag for that box or section. If it's a table, for example, the opening tag would be

2007-07-23 12:04:34 · answer #3 · answered by Erin C. 2 · 0 0

Ditto all the above, or sometimes, when appropriate, it may help (if you're sure it's a box) to set the margin for the box to some ridiculous amount such as "margin-left: -1000px;"

And if it's a text box you can go to extremes:
"margin-left: -1000px; margin-top: 0; margin-bottom: 0; padding: 0; border: 0; font-size: 0.1em; line-height: 1px; "

...get the idea?

2007-07-23 14:41:24 · answer #4 · answered by fjpoblam 7 · 0 0

Commenting it out hides it for good until you uncomment it... but you will still be able to see the code in the source code.

display: none; will work and when you want to make it "re-appear" just remove that from the css.

If you want something that just hides the box, div, whatever that the user can control... for instance:

HTML:

Toggle Div Visibility

Javascript:

function toggleDiv(divid){
var dv = document.getElementById(divid);
dv.style.display = (dv.style.display == ‘none’? ‘block’:'none’);
}

2007-07-23 12:15:01 · answer #5 · answered by Dirty Randy 6 · 0 0

ok, if you want to hide it "for good", just comment it out


or if you want to act with it, hide it with css


whats cool about above is you can un-hide with javascript

document . getElementById('hidden_box') . style.display='block';

2007-07-23 12:05:05 · answer #6 · answered by WebDev 3 · 0 0

fedest.com, questions and answers