Monday 6 March 2017

HTML Lesson - 7

Seventh Lesson of HTML














<!DOCTYPE html>
<html>

<head>

<title>Seventh Lesson of HTML</title>

<style>
.festive h4{
     color: red;
     font-family:calibri;
}
.festive p{
     color: blue;
     font-family:verdana;
}
</style>
</head>

<body>
<h2>What are classes in HTML ???</h2>


<p>The class is an attribute in HTML, which helps in defining the same style to each element with the same class name. CSS through class can be defined using [ . ] as prefix i.e.  .classname.</p>

For example:

<div class="festive">

<h4>DIWALI </h4>

<p>Diwali is the festival of lights. It is a five day festival and celebrated with the great joy and happiness.</p>

</div>


<div class="festive">

<h4>CHRISTMAS</h4>

<p>Christmas is the festival of forgiveness mainly celebrated by Christian Community. Lord Jesus, born on this auspicious day. Carols and Cakes make this festival more joyful.</p>
</div>


<div class="festive">

<h4>HOLI</h4>

<p>Holi is the festival of colors. It spreads a message of unity for all with different caste and communities, just like different colors merge in each other.</p>
</div>
</body>
</html>


Now, few key points to remember:

  •    A class should always be call with [ . ] or dot as prefix.
  •    Same class can be used for multiple elements.

0 comments:

Post a Comment