这里(http://livespot.pl/gw2/forum/)在黑色背景上,我需要背景尺寸:auto;.但是在那个白色/红色的背景上,我需要背景尺寸:封面;我听不懂。为什么?
.l-submain:nth-child(2) {
    background-image: url(http://livespot.pl/wp-content/uploads/2014/01/background.jpeg);
    background-size: auto;
}发布于 2014-02-25 10:57:34
:nth-child()选择器选择第n个子元素,而不管它有什么类。在您的示例中,:nth-child(2)是类.l-submain的第一个元素。

要使用.l-submain类选择第二个元素,您必须选择l-main的第三个子元素
.l-main :nth-child(3) {
    ...
}或者,因为它是.l-main的最后一个孩子
.l-main :last-child {
    ...
}https://stackoverflow.com/questions/22012042
复制相似问题