5
經過一些挖掘後,我發現this作爲我需要有圓角的桌子的最佳反應。圓角桌與LESS
導致我到下面的CSS代碼片段:
.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;
}
現在我想知道我怎麼能簡化所有這些用量少。我嘗試以下更少的代碼:
.border-radius (@v, @h, @radius: 5px) {
[email protected]@h: @radius;
[email protected]@h: @radius;
[email protected]@h: @radius;
}
,然後調用它(的左上角):
.greytable tr:first-child th:first-child {
.border-radius('top', 'left')
}
但它不工作(就少片段的第二行錯誤) 。
在此先感謝!
我修正了我的硬編碼錯誤,你可以相應編輯。非常感謝! – janosrusiczki 2012-03-02 09:17:06
至少在WinLess中仍然無法工作。 – janosrusiczki 2012-03-02 09:26:02
是的,我被困住了,現在太疲倦了。我明天會檢查一下,看看你是怎麼做出來的。 – 2012-03-02 09:53:07