1) .class
The .class selector styles all elements with the specified class.
The .class selector is supported in
Syntax
.class
{
declarations;
{
declarations;
}
<html>
<head>
<style>
.box {
padding: 20px;
margin: 10px;
width: 240px;
color: orange
}
</style>
</head>
<body>
<h1>Welcome to My Homepage</h1>
<div class="box">
<p> My name is Donald.</p>
<p> I live in Duckburg.</p>
</div>
</body>
</html>
<html>
<head>
<style>
p.hometown
{
background:yellow;
}
</style>
</head>
<body>
<p>My name is Donald.</p>
<p class="hometown">I live in Ducksburg.</p>
<p>My name is Dolly.</p>
<p class="hometown">I also live in Ducksburg.</p>
</body>
</html>
No comments:
Post a Comment