HTML Block and Inline Elements
<address> |
<article> |
<aside> |
<blockquote> |
<p> |
<pre> |
<canvas> |
<dd> |
<div> |
<dl> |
<section> |
<dt> |
<fieldset> |
<figcaption> |
<figure> |
<ol> |
<footer> |
<form> |
<h1>-<h6> |
<header> |
<hr> |
<li> |
<main> |
<nav> |
<noscript> |
<table> |
<tfoot> |
<ul> |
<video> |
Inline Elements
- An inline element does not start on a new line and only takes up as much width as necessary.
- This is an inline <span> element inside a paragraph.
Example
<html>
<body>
<div style="background-color:black;color:white;padding:20px;">
<h2>India</h2>
</div>
</body>
</html>
Try it »
Inline elements in HTML:
<a> |
<abbr> |
<acronym> |
<b> |
<bdo> |
<big> |
<br> |
<button> |
<cite> |
<code> |
<dfn> |
<em> |
<i> |
<img> |
<input> |
<kbd> |
<lable> |
<map> |
<object> |
<output> |
<q> |
<samp> |
<script> |
<select> |
<small> |
<span> |
<strong> |
<sub> |
<sup> |
<textarea> |
<time> |
<tt> |
<var> |
The <div> Element
- The <div> element is often used as a container for other HTML elements.
- The <div> element has no required attributes, but style, class and id are common.
- When used together with CSS, the <div> element can be used to style blocks of content
Example
<html>
<body>
<div style="background-color:black;color:white;padding:20px;">
<h2>India</h2>
</div>
</body>
</html>
Try it »
The <span> Element
- The <span> element is often used as a container for some text.
- The <span> element has no required attributes, but style, class and id are common.
- When used together with CSS, the <span> element can be used to style parts of the text.
Example
<html>
<body>
<h1>This is a<span style="color:red">Dangerous</span> Heading</h1>
</body>
</html>
Try it »