Block-level and Inline elements?

  • Block-level elements: Start on a new line, take full width. Examples: <div>, <p>, <h1>.
  • Inline elements: Stay within a line, take only needed space. Examples: <span>, <a>, <strong>.

✔ Example:

<p>This is <span style="color:red;">inline text</span> inside a paragraph.</p>

Comments

Leave a Reply

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