html block elements and inline elements


HTML elements are used to create the structure and content of a web page. 
There are two types of HTML elements: 
block-level elements and inline elements.

Block-level 

elements take up the full width of their parent container 
and create a new block formatting context. 
Examples of block-level elements include <div>, <h1>, <p>, and <form>.

Inline elements 

Only take up as much width as necessary and do not create a new block formatting context. 
Examples of inline elements include <span>, <a>, <img>, and <strong>.

Note:
Inline elements can be used within block-level elements, but block-level elements cannot be used within inline elements.



No comments:

Post a Comment