Class
<!DOCTYPE html>
<html>
<head>
<style>
/* ex1 */
.city {
background-color: tomato;
color: white;
padding: 10px;
}
/* ex2 */
/* .main {
text-align: center;
} */
</style>
</head>
<body>
<h2>The class Attribute</h2>
<p>Use CSS to style elements with the class name "city":</p>
<h2 class="city main">London</h2>
<p>London is the capital of England.</p>
<h2 class="city">Paris</h2>
<p>Paris is the capital of France.</p>
<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</body>
</html>
'HTML' 카테고리의 다른 글
iframe (0) | 2023.02.01 |
---|---|
Id (0) | 2023.02.01 |
Block&Inline (0) | 2023.02.01 |
Lists (0) | 2023.02.01 |
TableColgroup (0) | 2023.02.01 |