Is it possible to make a div invisible without commenting it out? If so, how?
Display none will ensure the DIV box is empty, and visibility hidden will ensure it isn't visible.
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.
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.
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.
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 :)
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With