Another day , another lesson , another step forward
Hi Guys, this is my day 3 of learning HTML. Today i learned about how the HTML elements are displayed in the webpage.
Mainly, there are only two types :
- Block-level Element
- Inline Elements
Block-Level Element:
- Block-level element is one of the type of displaying the HTML elements in the webpage.
- The Block-level element takes the complete width of its parent element.
- The Block-level elements are always starts in the new line.
- Example for Block-level elements are
<div>,<section>,<p>. I only listed few tags here, but HTML provide more Block-level elements.
Example:
Output:
In the above example, you can clearly understand behavior of block-level elements. Even though i given the <div> element next to <section> element, but it starts on the new line only.
Inline Element:
- Inline element is the another type of displaying the HTML elements in the webpage.
- The Inline element only takes the required width.
- The Inline elements does not always starts in the new line.
- Inline elements are mainly used for styling purpose.
- Example for Inline elements are
<strong>,<span>,<img>,<a>. I only listed few tags here, but HTML provide more Inline elements.
Example:
Output:
From this example, we have an clearly idea about the Inline elements. Here, the <span> element is used for styling purpose. The <a> element and <textarea> both the elements are inline elements , so they only taken the required width and continues on the same line.
Easy way to remember:
Block Element → Creates a "block" and moves the next content to a new line.
Inline Element → Stays "in line" with surrounding content.
See you in the next learning update!




Top comments (0)