Ad Code

If you click or tap on the page or redirect to another page, so sorry this is a technical issue. Please come back and read aur articles or post.

यदि आप पृष्ठ पर क्लिक या टैप करते हैं या किसी अन्य पृष्ठ पर रीडायरेक्ट करते हैं, तो क्षमा करें यह एक तकनीकी समस्या है। कृपया वापस आएं और हमारे लेख या पोस्ट पढ़ें।

What is a class in html.

 

  

What is a class in html

Q1.What is a class ?
ans. 
  • The class is an attribute which specifies one or more class names for an HTML element.
  • The class attribute can be used on any HTML element.
  • The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name.

EXAMPLE OF A CLASS PWORED BY W3SCHOOL

<!DOCTYPE html>
<html>
<head>
<style>
.city {
  background-color: tomato;
  color: white;
  border: 2px solid black;
  margin: 20px;
  padding: 20px;
}
</style>
</head>
<body>

<div class="city">
  <h2>London</h2>
  <p>London is the capital of England.</p>
</div>

<div class="city">
  <h2>Paris</h2>
  <p>Paris is the capital of France.</p>
</div>

<div class="city">
  <h2>Tokyo</h2>
  <p>Tokyo is the capital of Japan.</p>
</div>

</body>
</html>

Post a Comment

0 Comments

Ad Code