HTML Block and Inline Elements

In this chapter we learn display value for most elements is block or inline.

Block-level Elements

A block-level element starts left to right as far

The <h1> element is a block-level element.

Examples of block-level elements:

  • <p>
  • <form>
  • <div>
  • <h1> - <h6>

Inline Elements

An inline element does not start left to right you can place anywhere

This is an inline <span> element inside a paragraph.

some example of inline elemets:

  • <a>
  • <img>
  • <span>

The <div> Element

element have

Simple example are given:-


<div style="background-color:black; color:white; padding:20px;">

<p> India (IAST: Bhārat), also called the Republic of India (IAST: Bhārat Gaṇarājya), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country (with over 1.2 billion people), and the most populous democracy in the world.</p>

Try it Yourself »

The <span> Element

The <span> element is an inline element that is often used as a container for some text.

<span< element have style and class no required attributes

When used together with CSS, the <span> element can be used to style parts of the text:


<h1>Never <span style="color:green">Be The</span> Same</h1>
Try it Yourself »

Welookups is optimized for learning.Copy right 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.