There are 2 method in css where you can make a div invisible. Its important to know how to hide a div or any given container dynamically, to improve the user interactions in modern web sites. Method for Making a Div Invisible 1. Using Display Attribute in CSS 2. Using Visibility Attribute in CSS Using Display Attribute in CSS Invisible div can be created by setting the display attribute in css to none. In the following example div which has a id named divId will be set to invisible. Important thing here is after hiding, the div stays in the web page but no space is taken from the web page. You can make the div visible whenever needed by setting the display attribute to block. 1 #divId { 2 display:none; 3 } Demo Display Attribute Using Visibility Attribute in CSS Another method of creating Invisible div is to set the visibility attribute in css to hidden. In the following example div which has a id named divId will be set to invisible. Important thing here is after hiding, the div stays in the web page and space will be taken from the web page. So in this situation even though you hide the div, area contained by the div will be shown as blank. You can make the div visible whenever needed by setting the visibility attribute to visible.
Resize For More Content
#resizable {
text-align:center;
width: 350px;
height: 150px;
padding: 5px;
overflow: hidden
}
#resize_msg {
background-color: #3084DD;
color: #fff;
width: 350px;
padding: 5px;
font-size: 14px;
font-weight: bold;
}
$(function() {
$("#temp_resize").html($( "#resizable" ).html());
var actual_height = $("#temp_resize").height() + 30;
$( "#resizable" ).resizable({
minWidth:350,maxWidth: 350,maxHeight:actual_height
});
$("#resizable").resize(function() {
if($('#resizable').height() > (actual_height - 30)){
$("#resize_msg").html("No More Content");
}else{
$("#resize_msg").html("Resize For More Content");
}
});
});
There are 2 method in css where you can make a div invisible. Its important to
know how to hide a div or any given container dynamically, to improve the user interactions in
modern web sites.
Method for Making a Div Invisible
1. Using Display Attribute in CSS
2. Using Visibility Attribute in CSS
Using Display Attribute in CSS
Invisible div can be created by setting the display attribute in css to none. In the following
example div which has a id named divId will be set to invisible. Important thing here is after
hiding, the div stays in the web page but no space is taken from the web page. You can make
the div visible whenever needed by setting the display attribute to block.
1
#divId {
2
display:none;
3
}
Demo Display Attribute
Using Visibility Attribute in CSS
Another method of creating Invisible div is to set the visibility attribute in css to hidden.
In the following example div which has a id named divId will be set to invisible. Important
thing here is after hiding, the div stays in the web page and space will be taken from the
web page. So in this situation even though you hide the div, area contained by the div will
be shown as blank. You can make the div visible whenever needed by setting the visibility
attribute to visible.