Select Page

Block And Inline Level Tags in HTML


Block elements start on a new line and end with a carriage return. That’s, immediately after ending on a horizontal space, next block element goes to nest line.


nanadwumor

June 14, 2023

Block And Inline Level Tags in HTML


  • A block level element is like a container. It can contain other elements.
  • Examples of block level elements include header (h1,h2,h3,h4,h5,h6) , paragraph tag <p>, <div> etc

  • Inline elements stay in line with other elements without occupying a fresh line.
  • Examples of inline elements are <a>, <strong>, <span>

RECOMMENDED ARTICLES


Difference Between Absolute and Relative References in HTML
Difference Between Absolute and Relative References in HTML

A relative reference does not specify the complete path to a web page. It specifies only the name of the web page. An absolute reference or url contains all the information necessary to locate a resource or target A relative reference does not...

Selecting a browser for HTML5 development
Selecting a browser for HTML5 development

Google's Chrome browser is simple to use and has the most up-to-date HTML5 features making it easier for developers. It also has pretty good developer tools. We recommend you use this browser to learn HTML5 Chrome Firefox Opera Apple Safari...

Top 10 HTML5 formatting tags
Top 10 HTML5 formatting tags

HTML offers a range of elements for formatting text. HTML formatting tags include : <b> - Bold text <strong> - Important text <i> - Italic text <em> - Emphasized tex <mark> - Marked tex <small> - Smaller text <del> - Deleted...



HTML tags can be generally categorized in two groups. These are block level and Inline level tags. There are more block level elements in HTML than inline elements.


Join Other Subscribers on Our YouTube Channel and Don’t Miss a thing!


Block level elements

A block level element is like a container. It can contain other elements. Visually, block level elements occupy the whole horizontal stretch of a space in a browser. Examples of block level elements include header (h1,h2,h3,h4,h5,h6) , paragraph tag <p>, <div> etc

Block elements start on a new line and end with a carriage return. That’s, immediately after ending on a horizontal space, next block element goes to nest line. 

For example,

<p>This is first line of text</p>

<p>This is second line of text</p> <p>This is third line of text</p>

Output

This is first line of text

This is second line of text

This is third line of text

We notice that each line of text delimited by <p> occupies a different space. Even when paragraph three begins immediately after paragraph two, we still see paragraph three moved to a different line.

Inline Elements

As the name suggests, inline elements stay in line with other elements without occupying a fresh line. They are in line. 

That’s, inline elements are displayed on the same line. They do not start on a new line. They take up as much width as their contents require. 

Examples of inline elements are <a>, <strong>, <span> etc

Output

Block And Inline Level Tags in HTML

In the above example, we see two <span> tags staying in same line with each other as well as the <p> tag. 

Most HTML tags used for formatting are inline. Examples include <strong>, <em>, etc.


You May Also Like…




0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *