- Mastering CSS
- Rich Finelli
- 73字
- 2025-02-26 11:48:47
Targeting .column using a pseudo class
Adding the .column:first-child selector will target the first appearance of the column element. We'll add margin-left as zero. When we save this, we get three equal columns with a margin-left for each of them, except the first:
.column:first-child { margin-left: 0; }
Following is the output of preceding code block:

This technique would work just as well with two columns, four columns, or any number of columns.