What is differnce between HTML Block and Inline Elements

3/14/2024
All Articles

#What is differnce between HTML Block Inline Elements

What is differnce between HTML Block and Inline Elements

What is differnce between HTML Block and Inline Elements


In HTML, elements are categorized into two main types based on their default display behavior: block-level elements and inline elements.


Block-level elements:

 

  • <div>: Defines a division or section in an HTML document.
  • <p>: Represents a paragraph of text.
  • <h1> - <h6>: Heading elements, ranging from the most important (h1) to the least important (h6).
  • <ul>: Defines an unordered list.
  • <ol>: Defines an ordered list.
  • <li>: Represents a list item within an ordered or unordered list.
  • <table>: Defines a table.
  • <form>: Represents a form for user input.
  • <header>: Represents a header section in a document or section.
  • <footer>: Represents a footer section in a document or section.


Block-level items usually begin on a new line and automatically occupy the entire available width. They stack vertically on top of one another to form a visual "block" on the page.


Inline elements:

  • <span>: Defines a span of text within a document.
  • <a>: Creates hyperlinks to other web pages or resources.
  • <strong>: Indicates strong importance, usually displayed in bold.
  • <em>: Indicates emphasis, usually displayed in italics.
  • <img>: Embeds an image into the HTML document.
  • <input>: Defines an input control within a form.
  • <button>: Defines a clickable button.
  • <label>: Defines a label for an <input> element.
  • <br>: Represents a line break within text.
  • <small>: Represents small print, like legal text.

 

Conclusion

In this articles,we learn difference between Inline and Block element .The default behaviour of block-level and inline elements influences the layout and formatting of the web page, so knowing the difference is essential for good HTML structure and CSS styling.

Article