CSS Class in Head Section
×
Home Courses Community Support
CSS Class in Head Section

As you learn to write Inline CSS. If we need to write same CSS for more then one tags then using a Class us better option. A class is used to apply same CSS properties at more then one place.
 

To add a class with in HTML page we need to use <style> tag within head of the page. Inside style tag you can add any number of classes, IDs. (We will learn about ID in CSS module.)
 

Let's write previous heading's CSS using class.

<!DOCTYPE html>
<html>
<head>
<title>Use of division</title>
<style>
.design{
height:400px; 
width:500px; 
text-align:center; 
background-color:#CCCCCC; 
padding:50px; 
margin:50px;
}
</style>
</head>
<body>
<div class="design">
<h2>CSS is used to define the properties of this division.</h2>
</div>
</body>
</html>

 

This code will give same output as you got in previous heading.

 

enlightenedWe manage all the division in HTML likely above divison given in code.

 

 

← Preview

Use Style with in DIV Element

Next →

Use of Comments in HTML

NOTES

Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.

Courses

  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App