Use Style with in DIV Element
×
Home Courses Community Support
Use Style with in DIV Element

As you know division is used to group elements to apply CSS on them. To apply CSS to a division we use style with in start div tag. CSS written in start div tag will work for all the elements of that divisions.

See below example -

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

 

Output of this code is given in below image-
 

 

enlightenedIn same manner we can write CSS on other tags. Writing CSS in same line is called Inline CSS.

 

← Preview

Use Division Instead of Table

Next →

CSS Class in Head Section

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