CSS

CSS

🎯 CSS caption-side Property

The caption-side CSS property controls the position of the <caption> element in an HTML table.

It defines whether the table caption appears above or below the table.

🔹 Why Use caption-side?

This property is useful for controlling the layout and readability of table captions in different design structures.

  • Improves table layout control
  • Enhances readability of table titles
  • Helps in responsive table design
  • Allows flexible UI structure

🧩 caption-side Values

1️⃣ top (Default)

The caption is displayed above the table. This is the default behavior.

CSS

table {
    caption-side: top;
}
                

Most browsers use this as the default caption position.

2️⃣ bottom

The caption is displayed below the table.

CSS

table {
    caption-side: bottom;
}
                

This is useful when you want the title to appear after the table content.

3️⃣ initial

Resets the property to its default value (top).

4️⃣ inherit

Inherits the value from the parent element.

📌 Quick Summary

  • 🧠 Overview

  • top → places caption above the table (default)
  • bottom → places caption below the table
  • initial → resets to default value
  • inherit → takes value from parent element