In this lecture, I will explain the fundamental difference between BLOCK and INLINE elements.
Block Element
Any HTML element which takes full available width no matter what is an block element.
Some of the block elements are mentioned below:
- p
- h1, h2, h3, h4, h5, h6
- ol, ul
- pre
- address
- blockquote
- dl
- div
- fieldset
- form
- hr
- noscript
- table
Inline Elements
Any element which takes only the required space is an inline element. Inline elements can sit next to other on same line (if sufficient width is available).
here are some inline elements:
b, big, i, small, tt abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var a, bdo, br, img, map, object, q, script, span, sub, sup button, input, label, select, textarea
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML COURSE</title>
</head>
<body>
<h1>I am a block element</h1>
<span>I am an inline element</span>
</body>
</html>I hope you will like it. If you face any issue or have any doubt please connect with me via facebook messenger chat floating on the right side of the screen :)
happy learning :)
