-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay_v_visibility.html
More file actions
22 lines (16 loc) · 1.14 KB
/
display_v_visibility.html
File metadata and controls
22 lines (16 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<body>
<h1>What Can JavaScript Do?</h1>
<h2><p id="demo1">JavaScript can remove HTML elements.</p></h2>
<p>Using “style.display=‘none’” eliminates the HTML element and its occupied space.</p>
<p><button type="button" onclick="document.getElementById('demo1').style.display='none'">display=none</button></p>
<p>Using “style.display=‘inline’” returns the HTML element and its occupied space to default value.</p>
<p><button type="button" onclick="document.getElementById('demo1').style.display='inline'">display=inline</button></p>
<h2><p id="demo2">JavaScript can hide HTML elements.</p></h2>
<p>Using “style.visibility=‘none’” hides the HTML element but leaves its occupied space.</p>
<p><button type="button" onclick="document.getElementById('demo2').style.visibility='hidden'">visibiliy=hidden</button></p>
<p>Using “style.visibility=‘none’” reners the HTML element and its occupied space.</p>
<p><button type="button" onclick="document.getElementById('demo2').style.visibility='visible'">visibiliy=visible</button></p>
</body>
</html>