Difference between "inline", "block" and "none": - Javascript CSS Style Property

Javascript examples for CSS Style Property:display

Description

Difference between "inline", "block" and "none":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>Select a display type in the list below to change <span id="mySpan" style="color:blue;">this span element's</span> display type.</p>

<select onchange="myFunction(this);" size="3">
<option>block
<option>inline
<option>none
</select>//from   w w  w.j a  v  a  2s  .c om

<script>
function myFunction(x) {
    var whichSelected = x.selectedIndex;
    var sel = x.options[whichSelected].text;
    var elem = document.getElementById("mySpan");
    elem.style.display = sel;
}
</script>

</body>
</html>

Related Tutorials