Mastering CSS
上QQ阅读APP看书,第一时间看更新

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.