【发布时间】:2012-03-02 18:15:56
【问题描述】:
在 SO 上进行了一些挖掘之后,我发现 this 是我需要圆角的桌子的最佳响应。
这导致我使用以下 CSS sn-p:
.greytable tr:first-child th:first-child {
-moz-border-radius-topleft: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
}
.greytable tr:first-child th:last-child {
-moz-border-radius-topright: 5px;
-webkit-border-top-right-radius: 5px;
border-top-right-radius: 5px;
}
.greytable tr:last-child td:first-child {
-moz-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.greytable tr:last-child td:last-child {
-moz-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
}
现在我想知道如何使用 LESS 简化所有这些。我尝试了以下 LESS 代码:
.border-radius (@v, @h, @radius: 5px) {
-moz-border-radius-@v@h: @radius;
-webkit-border-@v-@h: @radius;
border-@v-@h: @radius;
}
然后调用它(左上角):
.greytable tr:first-child th:first-child {
.border-radius('top', 'left')
}
但它不起作用(LESS sn-p 的第二行错误)。
提前致谢!
【问题讨论】: