DIV Tag
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML TUTORIAL</title>
</head>
<body>
<div class="para_1">
<h3>dummy content</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div class="para_2">
<h3>dummy content</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias voluptatibus eaque reiciendis laudantium perferendis. At veritatis quibusdam amet quos debitis molestias minima nulla accusantium in incidunt, sequi dignissimos voluptate soluta.</p>
</div>
</body>
</html>
ID Attribute
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML TUTORIAL</title>
<style>
body{
background: aliceblue;
}
</style>
</head>
<body>
<div id="para_1">
<p>paragraph 1 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div id="para_2">
<p>paragraph 2 .Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias voluptatibus eaque reiciendis laudantium perferendis. sequi dignissimos voluptate soluta.</p>
</div>
<div id="para_3">
<p>paragraph 3 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div id="para_4">
<p>paragraph 4 .Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias voluptatibus eaque reiciendis laudantium perferendis. sequi dignissimos voluptate soluta.</p>
</div>
<div id="para_5">
<p>paragraph 5 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div>
<button id="hideparagraph" onclick="hide()">CLICK</button>
</div>
<script>
function hide(params) {
document.getElementById('para_2').style.display='none';
}
</script>
</body>
</html>
Class Attribute
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML TUTORIAL</title>
<style>
body{
background: aliceblue;
}
</style>
</head>
<body>
<div id="para_1">
<p class="insidePara1 para">paragraph 1 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div id="para_2">
<p>paragraph 2 .Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias voluptatibus eaque reiciendis laudantium perferendis. sequi dignissimos voluptate soluta.</p>
</div>
<div id="para_3">
<p class="insidePara1">paragraph 3 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div id="para_4">
<p>paragraph 4 .Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias voluptatibus eaque reiciendis laudantium perferendis. sequi dignissimos voluptate soluta.</p>
</div>
<div id="para_5">
<p class="para">paragraph 5 . Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
<div>
<button id="hideparagraph" onclick="hide()">CLICK</button>
</div>
<script>
function hide(params) {
var paragraphs = document.getElementsByClassName('insidePara1');
for (var i = 0; i < paragraphs.length; i++) {
paragraphs[i].style.color = 'red';
paragraphs[i].style.fontSize = '20px';
}
}
</script>
</body>
</html>