Enterprise Verified
Academy Frontend Web Development HTML HTML Block and Inline Elements
Advertisement
Google AdSense Slot (LEADERBOARD)
Automated High-CTR Ad Rail • Set Publisher ID in config/adsense.php
Display Model 6 min read • Chapter 18 of 32

HTML Block and Inline Elements

Every HTML element has a default display value, depending on what type of element it is: block or inline.

A block-level element always starts on a new line and takes up the full width available (e.g. <div>, <p>, <h1>). An inline element does not start on a new line and only takes up as much width as necessary (e.g. <span>, <a>, <b>).

Example

<!DOCTYPE html>
<html>
<body style="font-family:sans-serif;padding:20px;">
    <div style="border:2px solid blue;padding:8px;margin-bottom:8px;">Block Element (&lt;div&gt; takes full width)</div>
    <span style="border:2px solid green;padding:4px;">Inline Element 1</span>
    <span style="border:2px solid orange;padding:4px;">Inline Element 2 (Sits alongside)</span>
</body>
</html>
Try it Yourself >> Opens live sandboxed code editor
Advertisement
Google AdSense Slot (IN-ARTICLE)
Automated High-CTR Ad Rail • Set Publisher ID in config/adsense.php

Community Q&A & Discussion

No questions yet. Be the first to start the discussion!
Enterprise Operations Suite

Streamline Employee Payroll & Attendance Operations

Eliminate manual spreadsheet errors. Integrate automated attendance tracking, EPF/ESI statutory calculations, and custom GST invoices.

Copied!

AI Learning Assistant

Ready to explain & guide

Hello! I am your MBS Digital AI Tutor. Ask me to explain concepts, review code, or suggest debugging steps.

Quick Starters:
AI Tutor is thinking...