0
當我做我的CSS文件,我有這樣的:是否有合併類聲明的(純)CSS運算符?
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
button{
padding:10px
border-radius:10px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
button,
.shadow{
box-shadow: ....
}
我可以以某種方式合併純CSS這兩個聲明,所以我會,相反,有這樣的事情:
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
button{
padding:10px
border-radius:10px;
}
+ // some operator that would join the next class declaration on the previous declaration
.shadow{
box-shadow: ....
}
標題上的「純」,我的意思是沒有LESS或SASS可以做到這一點嗎?
沒有,但如果你使用CSS預處理器,這個功能是相當微不足道的:) – Terry
還沒有,但有一個規範草案旨在支持這個,[這裏](https ://tabatkins.github.io/specs/css-nesting/)。 – glhrmv