The <div> tag defines a division or a section in an HTML document.
The <div> tag is used to group block-elements to format them with CSS.
Example
different div id & div class
1. <!DOCTYPE HTML>
<html>
<head>
<style>
#mycolor1 {color: red;}
.mycolor2 {color: red;}
</style>
</head>
<body>
<div id="mycolor1"> hello world </div>
<div class="mycolor2"> hello world </div>
</body>
</html>
2. <!DOCTYPE html>
<html>
<html>
<head>
<style>
div {
display: block;
}
</style>
</head>
<body>
A div element is displayed like this:
<div>This is some text in a div element.</div>
Change the default CSS settings to see the effect.
</body>
</html>
No comments:
Post a Comment