CSS Portal

::column CSS Pseudo Element

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The ::column pseudo-element in CSS represents the individual columns generated by a multi-column layout on a block-level element. It is part of the CSS Multi-column Layout Module and allows developers to target and style content specifically within each column of a multi-column container. This pseudo-element is especially useful when you want to apply visual effects, spacing adjustments, or other styling selectively to each column rather than the entire container.

Unlike pseudo-elements such as ::before or ::after, which generate content before or after an element’s main content, ::column doesn’t create new content. Instead, it represents the existing flow of content within a column, allowing properties like border, background, margin, and padding to be applied individually to each column. Notably, some properties, such as box-shadow, can be visually impactful when applied at the column level because each column is treated as a separate box.

One practical use of ::column is to style the first column differently from the rest. While the pseudo-class :first-child targets elements based on their position in the DOM, ::column works specifically with the columnized content. For example, you can apply a subtle background color to all columns except the first, or add a decorative border between columns for a magazine-like layout:

<div class="multi-column">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque...</p>
  <p>Additional content that flows across multiple columns.</p>
</div>
.multi-column {
  column-count: 3;
  column-gap: 20px;
}

.multi-column::column {
  background-color: #f0f0f0;
  padding: 10px;
  border-left: 1px solid #ccc;
}

.multi-column::column:first-child {
  background-color: #ffffff;
  border-left: none;
}

In this example, the container <div> with class div is split into three columns. The ::column pseudo-element is used to add a background, padding, and a left border to each column. The first column is styled slightly differently to visually distinguish it.

It’s important to note that browser support for ::column is not universal, and some older browsers may not recognize it. Therefore, while ::column offers powerful styling control, it should be used with fallback strategies or progressive enhancement in mind.

If desired, ::column can be combined with other pseudo-classes such as :nth-child to target columns in specific positions for more advanced layouts.

Syntax

::column {
  /* ... */
}

Example

<div class="carousel-container">
<ul class="scroll-container">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
</ul>
</div>
/* 1. The Parent: Setup the Multi-column Scrollport */
.scroll-container {
/* Set a fixed height and force content into columns */
height: 225px;
columns: 1; /* One column visible at a time */
column-width: 300px;
column-gap: 20px;

/* Enable horizontal scrolling and snapping */
overflow-x: auto;
scroll-snap-type: x mandatory;

/* Required for the pagination dots (markers) */
scroll-marker-group: after;

list-style: none;
padding: 0;
margin: 0;
}

/* 2. The Pseudo-Element: target the columns themselves */
.scroll-container::column {
/* This ensures that when you scroll, the browser
snaps exactly to the start of each column fragment */
scroll-snap-align: start;
}

/* 3. Navigation: Create automatic pagination dots */
.scroll-container::column::scroll-marker {
content: "";
display: inline-block;
width: 12px;
height: 12px;
border: 2px solid #333;
border-radius: 50%;
margin: 10px 5px;
cursor: pointer;
background-color: transparent;
}

/* Highlight the dot for the column currently in view */
.scroll-container::column::scroll-marker:target-current {
background-color: #333;
}

/* 4. Layout for the marker group */
::scroll-marker-group {
display: flex;
justify-content: center;
}

/* Basic styling for items */
li {
background: #3498db;
color: white;
margin-bottom: 10px;
padding: 20px;
border-radius: 8px;
/* Ensure items don't break awkwardly across columns */
break-inside: avoid;
}

Browser Support

The following information will show you the current browser support for the CSS ::column pseudo element. Hover over a browser icon to see the version that first introduced support for this CSS psuedo element.

This psuedo element is supported in some modern browsers, but not all.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 31st December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!