Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a div invisible without commenting it out?

Tags:

html

css

Is it possible to make a div invisible without commenting it out? If so, how?

like image 859
Mubeen Avatar asked Jun 12 '10 08:06

Mubeen


People also ask

How do I make something invisible in a div?

Display none will ensure the DIV box is empty, and visibility hidden will ensure it isn't visible.

How do you make a div invisible and visible in HTML?

Making it invisible with visibility still makes it use up space. Rather try set the display to none to make it invisible, and then set the display to block to make it visible.

How do you make a div not visible in CSS?

You can hide an element in CSS using the CSS properties display: none or visibility: hidden. display: none removes the entire element from the page and mat affect the layout of the page. visibility: hidden hides the element while keeping the space the same.

How do you make an invisible element in HTML?

You can also make an element so transparent that it's invisible using the opacity CSS property. Like visibility: hidden, opacity: 0.0 will leave an empty space where the HTML element is.


2 Answers

You need to hide that with CSS:

div {                    /* this will hide all divs on the page */   display:none; } 

If it is a particular div with certain class or id, you can hide it like:

<div class="div_class_name">Some Content</div> 

CSS:

div.div_class_name {     /* this will hide div with class div_class_name */   display:none; } 

Or

<div id="div_id_name">Some Content</div> 

CSS:

div#div_id_name {        /* this will hide div with id div_id_name */   display:none; } 

Note: You need to wrap CSS tyles in between <style type="text/css"></style> tags, example:

<style type="text/css">   div#div_id_name {     display:none;   } </style> 

More Information :)

like image 83
Sarfraz Avatar answered Oct 04 '22 01:10

Sarfraz


You can do this by inline style

<div style="display:none"></div> 

or by defining CSS Style like In css add

.HideableDiv{display:none;} 

and in your HTML write

<div class="HideableDiv" ></div> 
like image 34
Tasawer Khan Avatar answered Oct 03 '22 23:10

Tasawer Khan