Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何指定多个可以匹配给定选择器的类?_Css_Css Selectors - Fatal编程技术网

Css 如何指定多个可以匹配给定选择器的类?

Css 如何指定多个可以匹配给定选择器的类?,css,css-selectors,Css,Css Selectors,我正在尝试在我的CSS(wink)中进行干练练习,我被困在如何解决这个问题上 我如何减少这种情况: table.shipmentItemList TD.title, table.shipmentItemList TD.author, table.shipmentItemList TD.options { font-size: 1.0em; font-weight: normal; } 对这样的事情: table.shipmentItemList TD.title, TD.aut

我正在尝试在我的CSS(wink)中进行干练练习,我被困在如何解决这个问题上

我如何减少这种情况:

table.shipmentItemList TD.title,
table.shipmentItemList TD.author,
table.shipmentItemList TD.options {
    font-size: 1.0em;
    font-weight: normal;
}
对这样的事情:

table.shipmentItemList TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
}
table.shipmentItemList {
    td {
        &.title, &.author, &.options {
            font-size: 1.0em;
            font-weight: normal;
        }
    }
}
table.shipmentItemList{
  TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
  }
}
或者更好的是:

table.shipmentItemList TD .title, .author, .options {
    font-size: 1.0em;
    font-weight: normal;
}

我认为在这种情况下,您只能使用SASS:

标准CSS不允许您尝试做的事情。

看看,或者您更愿意在服务器上做。你所问的问题在香草CSS中是不可能的

您的示例如下所示:

table.shipmentItemList TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
}
table.shipmentItemList {
    td {
        &.title, &.author, &.options {
            font-size: 1.0em;
            font-weight: normal;
        }
    }
}
table.shipmentItemList{
  TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
  }
}

看看less.js,它可以让您执行以下操作:

table.shipmentItemList TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
}
table.shipmentItemList {
    td {
        &.title, &.author, &.options {
            font-size: 1.0em;
            font-weight: normal;
        }
    }
}
table.shipmentItemList{
  TD.title, TD.author, TD.options {
    font-size: 1.0em;
    font-weight: normal;
  }
}

如果你想在CSS中做这类事情,你就必须研究更少或更少的SASS。因为你的代码是标准CSS格式的,所以一切都很好。