#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
CSS3 Fundamentals

CSS3 Multiple Columns

CSS multi-column layout flows content into several columns, like a newspaper. You turn a single block of text or a list into columns with column-count or column-width, and the browser decides where each column breaks. It suits long article text, glossaries, footers with many links and tag lists. It is not a page-layout tool like Grid or Flexbox; it is for content that should read down one column and continue at the top of the next.

The core properties

  • column-count: the number of columns you want.
  • column-width: the ideal minimum width of each column. The browser fits as many as possible.
  • columns: shorthand for both, such as columns: 3 14rem.
  • column-gap: the space between columns.
  • column-rule: a line drawn in the gap, written like a border (1px solid #ddd).
  • column-span: all: lets a heading stretch across every column.
  • column-fill: balance (the default) evens out column heights; auto fills one column before the next when the container has a fixed height.

Responsive columns without media queries

Setting a column-width rather than a count makes the layout respond on its own. On a phone there is room for one column; on a wide screen, three or four appear. Combining both values caps the maximum.

.article-body {
  columns: 3 18rem;         /* at most 3 columns, each at least about 18rem */
  column-gap: 2.5rem;
  column-rule: 1px solid #e0e0e0;
}

.article-body h2 {
  column-span: all;         /* heading crosses all columns */
  margin-block: 1.5rem 1rem;
}

.article-body figure,
.article-body li {
  break-inside: avoid;      /* do not split these across columns */
}

.site-links {
  column-width: 12rem;
  list-style: none;
  padding: 0;
}

Controlling breaks

The browser breaks columns wherever it needs to, which can split a figure, a card or a list item in half. The break-inside: avoid property tells it to keep an element whole. You can also use break-before: column to force an element to start a new column. Older code sometimes uses page-break-inside, which still works as an alias.

Where multi-column goes wrong

The biggest mistake is using columns for a card grid where order matters across rows. Multi-column fills top to bottom, so items 1, 2 and 3 end up stacked in the first column, and readers scanning left to right see them out of order. For a grid of products or profiles, use CSS Grid instead.

A second problem is long text in narrow, short columns on a tall page. If a column is taller than the screen, readers must scroll down, then back up to start the next column, then down again. Keep multi-column text to sections that fit roughly within one screen height, or let it fall back to a single column on small screens.

Also watch margins. The top margin of the first element in a column can create uneven starts, so it often helps to remove the top margin from the first child.

Good uses at a glance

Use caseSuggested setting
Footer link listscolumn-width: 10rem
Glossary or indexcolumns: 4 12rem with break-inside: avoid on entries
Short article introcolumn-count: 2 with a column-rule
Masonry-style photo wallcolumn-width plus break-inside: avoid on images, accepting top-to-bottom order

Summary of the approach

Reach for multi-column when content should flow like a printed page. Prefer column-width for automatic responsiveness, keep items whole with break-inside: avoid, span headings with column-span, and switch to Grid when left-to-right order matters.

Ready to master real-world web development?

Learn HTML, CSS3, Bootstrap and JavaScript hands-on with mentor-led sessions.

Explore Course