Table of Contents

HTML div tag

  • The <div>  element is used for style blocks of content.
Example of HTML div tag
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="border: 5px outset red;background-color: lightblue;text-align: center;">
<p>This is a heading in a div tag</p>
<p>This is a div tag in paragraph.</p>
</div>
</body>
</html>

HTML Span tag

  • The <span> element is used for style parts of the text.
Example of HTML span tag
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>This is a <span style="color:blue;font-weight:bold">paragraph</span> .</p>
<p>This is a <span style="color:red;font-weight:bold">span tag</span> .</p>
</body>
</html>