Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Pick up a morning copy of an Indian daily newspaper like The Times of India or The Hindu, or inspect a printed CBSE board examination question paper. You will notice that text is never printed as a single line running all the way across an entire broadsheet page. If it did, your eyes would get exhausted trying to track 150 words on a single horizontal line!
Instead, articles flow into narrow vertical columns. When text reaches the bottom of Column 1, it automatically spills over to the top of Column 2, and continues seamlessly into Column 3.
While CSS Flexbox and Grid are ideal for positioning distinct component boxes, CSS Multi-Column Layout is the only native web specification designed specifically for flowing continuous prose and editorial text.
In a multi-column container, the browser handles text flow dynamically:
+-------------------------------------------------------------------------+
| THE CSS MULTI-COLUMN FLOW ARCHITECTURE |
+-------------------------------------------------------------------------+
[HEADLINE: column-span: all (Spans across all columns!)]
=========================================================================
COLUMN 1 | COLUMN 2 | COLUMN 3
The annual science | models explaining | winners received
exhibition at Delhi | solar satellite | certificates from
Public School was | propulsion and bio- | the state education
inaugurated with | enzymatic cleaning. | minister yesterday.
great fanfare. Over | |
500 student teams | Several distinguished| "Our students showed
presented working | mentors attended | extraordinary depth,"
prototypes and 3D | the event... | remarked the head...
| |
[column-rule: 1px solid divider line between columns]column-count vs column-widthYou can define columns in two ways:
column-count: Fixed Number of ColumnsForces the container into a specific number of columns:
Disadvantage: On a narrow mobile phone screen, 3 columns will become unreadable, 30-pixel-wide vertical slivers!
column-width: Optimal Responsive Column WidthSets the ideal minimum width for each column:
The Magic: If the screen is 900px wide, the browser automatically creates 3 columns. If the screen shrinks to 600px, it drops to 2 columns. On a 360px phone, it drops to 1 column without needing a single media query!
columns Shorthand:You can combine both count and width into the columns shorthand:
column-gap and column-ruleTo prevent text from colliding into neighboring columns, use column-gap. To draw classic editorial vertical divider lines, use column-rule:
column-rule does not take up any space of its own! It is drawn directly in the middle of the column-gap.column-span: allWhat if you want a prominent sub-heading, an inspiring quote, or an infographic banner to interrupt the columns and stretch across the full width of the page?
Declare column-span: all;:
+-------------------------------------------------------------------------+ | EFFECT OF column-span: all | +-------------------------------------------------------------------------+ [Column 1 Text...] | [Column 2 Text...] | [Column 3 Text...] ---------------------+-----------------------+--------------------- [FULL-WIDTH SUBHEAD: column-span: all (Breaks across everything!)] ---------------------+-----------------------+--------------------- [Column 1 continues] | [Column 2 continues] | [Column 3 continues]
break-inside: avoidA common issue in multi-column layouts is that the browser can slice a paragraph, warning box, or photo right down the middle across two separate columns:
To guarantee that callout boxes, exam notes, or images stay intact as a single solid unit, apply break-inside: avoid;:
| Layout System | Primary Purpose | How Content Flows | Real-World Metaphor |
|---|---|---|---|
| Multi-Column | Flowing continuous editorial prose | Continuous flow from bottom of column 1 to top of column 2 | Newspaper or book pages |
| CSS Grid | Structural 2D page architecture | Placed into distinct grid rows & columns | Construction scaffolding / Chessboard |
| Flexbox | 1D alignment of components | Distributed along single row or column | People lining up in an assembly line |
| Practice | Bad Approach | Good Approach | Why It Matters |
|---|---|---|---|
| Mobile Columns | Hardcoding column-count: 3; on mobile viewports | Using column-width: 260px; or columns: 280px 3; | Prevents cramped, unreadable vertical columns on mobile phones. |
| Unbroken Callouts | Letting note boxes get sliced across column breaks | Setting break-inside: avoid; on callout boxes | Prevents broken visual boxes and awkward reading interruptions. |
| Column Dividers | Adding manual right borders (border-right) on elements | Using column-rule: 1px solid #cbd5e1; | column-rule automatically appears between columns and omits outer margins. |
| Column Height | Fixing a rigid height: 200px; on long articles | Letting height remain auto | Fixed heights cause column content to overflow horizontally past screen bounds. |
column-count: N: Forces exactly $N$ columns.column-width: <length>: Responsive minimum column width; adds or removes columns automatically.columns: 260px 3: Recommended shorthand combining minimum width and maximum count.column-gap: Horizontal clearance between columns.column-rule: Border-like line drawn in the gap between columns.column-span: all: Breaks an element out of columns to span the entire container width.break-inside: avoid: Prevents child cards or figures from splitting across column boundaries.column-rule property render visually?height (e.g., height: 300px;) on a multi-column article container?Build an authentic Indian school journal newspaper page featuring a full-width masthead headline, a 3-column responsive layout with column rules, and an unbroken callout quote.
columns: 260px 3;, column-gap: 32px;, and column-rule: 1px solid #e2e8f0;.column-span: all;.break-inside: avoid;.Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 5 questions. Each question has one correct answer.