Is it possible to target CSS3 columns individually

2019-01-20 09:22发布

问题:

The design I am working to has different backgrounds for alternate columns. Is it possible to set up different tiling backgrounds for each column,

e.g.

column:nth-child(n+1) {background:url(tile1.gif) repeat-x; }

Or do I have to fall back on a huge background image that tiles every two columns?

回答1:

Unfortunately you cannot change the color of the columns:

It is not possible to set properties/values on column boxes. For example, the background of a certain column box cannot be set and a column box has no concept of padding, margin or borders.

From w3.org: 2. The multi-column model