Html For Beginners | Block And Inline Elements | Day 5 | 100 Days Of Web Development

7 months ago
21

Visit - www.skyhighes.com

Block and Inline Elements in HTML
In HTML, elements are categorized into two main types based on how they behave and display on the page: block elements and inline elements. Understanding these differences is crucial for building well-structured and visually appealing web pages.

Block Elements:

Start on a new line: They occupy the full width available to them, regardless of their content.
Force line breaks before and after: This creates space between them and surrounding elements.
Have default margin and padding: This further adds separation between them.
Examples: <p>, <h1>, <div>, <ul>, <table>
Inline Elements:

Flow within the line of text: They occupy only the space required for their content.
Don't force line breaks: They sit next to each other on the same line, flowing with the surrounding text.
Don't have default margin and padding: They sit closely together without inherent spacing.
Examples: <span>, <strong>, <em>, <a>, <img>

Loading comments...