HTML Div Tag

Whenever you want to apply some effect like change of text color on a group or over a large section of your document, you can use <div> tag. With the help of <div> tag, you can make a group of large sections of HTML elements together and apply CSS on that whole section. Developers usually use <div> element to group together large number of HTML elements and apply CSS styles to these elements in a single shot.

The main difference between the div tag and the span tag is that div is used with block-level elements whereas span is used with inline elements.

Syntax

<div style="color:#FF00FF;">
<p>Paragraph1</p>
<p>Paragraph2</p></div>

Example

<!DOCTYPE html>
<html>
<head>
<title>Span Example</title>
</head>
<body>
<div style="color:#FF00FF;">
<b>Welcome!</b>
<p>Welcome to TechStrikers!</p>
</div>
<p>Welcome to TechStrikers!</p>
</body>
</html>

This will produce following result

Welcome!

Welcome to TechStrikers!

Welcome to TechStrikers!

See Also

HTML Form Tags
HTML Page Formating Tags
HTML Other Tags


 
 
SHARE THIS IF YOU LIKE!
submit to reddit

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.