HTML Classes

Example

<!DOCTYPE html>
<html>
<head>
<style>
.cities {
background-color: green;
color: white;
margin: 20px;
padding: 20px;
}
</style>
</head>
<body>

<div class=”cities”>
<h2>surat</h2>
<p>London is the capital of England.</p>
</div>

<div class=”cities”>
<h2>rajkot</h2>
<p>Paris is the capital of France.</p>
</div>

<div class=”cities”>
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</div>

</body>
</html>

Output

Example

<!DOCTYPE html>
<html>
<head>
<style>
.cities {
background-color: skyblue;
color: black;
margin: 20px;
padding: 20px;
}
</style>
</head>
<body>

<div class=”cities”>
<h2>amreli</h2>
<p>London is the capital of England.</p>
</div>

<div class=”cities”>
<h2>junagadh</h2>
<p>Paris is the capital of France.</p>
</div>

<div class=”cities”>
<h2>gondal</h2>
<p>Tokyo is the capital of Japan.</p>
</div>

</body>
</html>

Output

Updated: February 11, 2019 — 10:24 am
Java Script © 2019