Block Level Elements: A block-level element always starts on a new line and stretches out to the left and right as far as it can.
div element: The div element is used as a container for other HTML elements. It has no required attributes. Style, class and id are the commonly used attributes.
Syntax
<div>GFG</div>
<!DOCTYPE html> <html> <body> <style> body { text-align: center; } h1 { color: #ad10a5; } </style> <!-- Div element. --> <div style="background-color:#e37070; color:white; padding:20px;"> <h1>Bajarangi Soft</h1> <h3>Bajarangi Soft is providing a Web designing courses.</h3> <h3>You can give reviews as well as contribute posts on this portal.</h3> </div> </body> </html>
<span>GFG</span>
<!DOCTYPE html> <html> <style> body { text-align: center; } h1 { color: #f3a113; } </style> <body> <!-- Sapn element. --> <h1>Bajarangi <span style="color:red"> for</span>soft</h1> </body> </html>