Saturday 17 September 2016

Html Class | Class in Html | how to use class in html

Html Class: Html Class attribute is used to define styles for Html elements with the same class name.


how to use the class in HTML
you can use the Html class attribute to define the styles for elements for different elements with the same class name.
how to use the class in HTML

Html class Example:


1.Define Class style in head Section


<style>
.back{ background-color:red; }
</style>

Class attribute starts with .(dot) then use the Class name and define style for that Html class.


2.Define class in body section


<body>
<div class="back">Html Class</div>
</body>

Here we call the class style with class="class-name" in the Html elements where you want to apply.

Html Class Example:

how to use the class in HTML


Html Class

Output of Html Class

Html Class
how to use the class in HTML
how to use the class in HTML

1 comment:

Leave a Reply!