---
# System prepended metadata

title: 'Understanding Block, Inline and Inline-Block Elements in Html'

---

# Understanding Block, Inline and Inline-Block Elements

**Introduction**
A good understanding of HTML elements and their role in web structuring is very important for web developers. Based on their behavior and characteristics, HTML elements can be broadly classified into three groups: block, inline, and inline-block. 

Each group exhibits unique display behavior on the web. Mastering how these elements function, interact, and can be manipulated is an essential skill for any beginner developer before delving deeper into the world of software development. This article will explore these three groups of elements, outlining the characteristics that define each category.

**Block Elements**
Block-level elements start on a new line, and the browser automatically adds top and bottom margins to them. A block-level element takes the full width of its container. It stretches as much as it can and doesn't allow any other element to appear directly beside it.

**Some Examples of Block-level Elements in HTML**
**`<div>`**: This serves as a container tag that can be used to separate content on a web page.
**`<`h1`>` to `<`h6`>`**: These elements are used to define headings ranging from 1 to 6. As the number decreases, so does the size.
**`<`hr`>`**: his is a self-closing element used to separate the contents of a page by a horizontal line.
**`<`ul`>`**: This is used to create unordered lists.
**`<`li`>`**: This tag is used for including list items within an ordered or unordered list.
**`<`ol`>`**: This is used to create ordered lists.
**`<`p`>`**: Thi`<`s is used to create paragraphs in a webpage.
**table**: When we have a need for tabular data, this element is used to include tables in the webpage.


**Inline Element**s
Inline elements do not start on a new line and allow other elements beside them. They don't have default top and bottom margins like block-level elements. An inline element does not take the full width of the screen but rather occupies just the width of its content. Inline elements can also be used within other elements.
    
**Some Examples of Inline Elements in HTML**
**`<`span`>`**: This is used to highlight a part of a text or paragraph.
**`<`img**`>`: This tag is used to add images to a web page.
**`<`a`>`**: This is used to create links to other web pages.
**`<`br`>`**: This is used to break a long line of text into different lines.
**`<`b`>`**: This is used to make a text bold.
**`<`button`>`**: This is used to create a clickable button.
**`<`input`>`**: This is used to get input from users.
**`<`textarea`>`**: This is like an extended input area. Users can add as much data as they want.


**Inline-block Elements**
Inline-block elements are a hybrid of block and inline elements, combining both characteristics. Inline-block elements, just like inline elements, do not start on a new line. But just like block elements, they can be given specific width and height. With the display property set to inline-block, the top and bottom margins are respected.

**Key Takeaways**
**Block-level Elements**: They start on a new line and take the full width of their container.

**Inline Elements**: They do not start on a new line and only take the width of their content.

**Inline-block Element**s: They do not start on a new line, and their top and bottom margins are respected.

It is worth noting that the examples given above are not exhaustive. More examples under each category can be found in the resources below too. This means that the examples provided for each category represent only a portion of the elements that fall within that category.

**Resources**
CSS Inline vs Inline-Block vs Block
https://www.samanthaming.com/pictorials/css-inline-vs-inlineblock-vs-block/

[CSS] - Difference between Inline-Block, Block, and Inline in CSS
https://www.shecodes.io/athena/3392-difference-between-inline-block-block-and-inline-in-css

HTML Block and Inline Elements
https://www.w3schools.com/html/html_blocks.asp

HTML Inline and Block Elements: Explained with Example
https://www.scholarhat.com/tutorial/html/html-inline-and-block-elements

Difference between block elements and inline elements
https://www.geeksforgeeks.org/difference-between-block-elements-and-inline-eleme

