重新使用常见的CSS规则有一个CSS样式表如下如何在CSS(SASS)
.icon1 {
&:after {
content:"";
float: right;
width: 8px;
height: 8px;
border-radius: 100%;
background-color: #4ac102;
display: block;
position: relative;
}
}
.icon2 {
&:after {
content:"";
float: right;
width: 8px;
height: 8px;
border-radius: 100%;
background-color: #f1342f;
display: block;
position: relative;
}
}
.icon3 {
&:after {
content:"";
float: right;
width: 8px;
height: 8px;
border-radius: 100%;
background-color: #616a83;
display: block;
position: relative;
}
}
正如你可以除了背景色所有其他属性都一样看。我可以重构此代码以使其变干吗?
这是一种题外话这么久。 CodeReview *可能更适合...但首先检查他们的指导。 –
@Paulie_D你为什么会认为它的话题? – Gagan
因为代码起作用。整理它或将它干燥并不是真正的问题。 –