Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
HTML The class Attribute
SUBMITTED BY:
whtm
DATE:
Dec. 27, 2016, 9:28 a.m.
FORMAT:
Text only
SIZE:
910 Bytes
Raw
Download
Tweet
HITS:
1017
Go to comments
Report
Using The class Attribute
The HTML class attribute makes it possible to define equal styles for elements with the same class name.
Here we have three <div> elements that points to the same class name:
Example
<!DOCTYPE html>
<html>
<head>
<style>
div.cities {
background-color: black;
color: white;
margin: 20px 0 20px 0;
padding: 20px;
}
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>London is the capital of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>
</div>
<div class="cities">
<h2>Paris</h2>
<p>Paris is the capital and most populous city of France.</p>
</div>
<div class="cities">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.</p>
</div>
</body>
</html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus