:left CSS Pseudo Class
Description
The :left pseudo-class in CSS is a structural pseudo-class that targets elements that are considered “left-aligned” in a particular context. It is primarily used in conjunction with table cells, flexbox, or grid layouts where an element’s placement can be determined relative to its container or its siblings. This pseudo-class allows developers to apply specific styles to elements that occupy the leftmost position without needing to manually assign classes or IDs. While not as commonly supported or widely implemented as pseudo-classes like :first-child, :left can be useful in highly controlled layout scenarios.
One common scenario where :left may be used is in table structures. For instance, the first column of a table can be targeted using :left to apply a unique background color, text alignment, or padding, helping differentiate it from other columns. Similarly, in CSS grid or flex layouts, items that start at the leftmost position in a row can be styled using this pseudo-class, allowing for easier visual cues or spacing adjustments.
Developers often combine :left with other CSS properties to achieve layout or stylistic effects. Properties like text-align, margin, and padding are commonly adjusted when using :left to ensure proper spacing and alignment. It is important to note that :left does not alter the DOM structure; it merely selects elements based on their visual or logical position.
Here is a simple example using a table:
<table>
<tr>
<td>Left Column</td>
<td>Right Column</td>
</tr>
<tr>
<td>Left Column</td>
<td>Right Column</td>
</tr>
</table>
td:left {
background-color: #e0f7fa;
text-align: left;
padding-left: 10px;
}
In this example, the :left pseudo-class targets all table cells that are in the leftmost position of their respective rows, giving them a distinct background and left padding. This approach simplifies styling patterns where a uniform look for the first column or left-aligned items is required.
The :left pseudo-class is part of a broader set of positional and structural pseudo-classes, which include :right, :first-child, and :last-child, each serving a similar purpose but targeting different positions or relationships within the DOM.
Syntax
:left {
/* ... */
}
Example
Browser Support
The following information will show you the current browser support for the CSS :left pseudo class. Hover over a browser icon to see the version that first introduced support for this CSS psuedo class.
This psuedo class is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
