[英]How do you define attribute selectors in SASS?
In CSS, you can do this :在 CSS 中,您可以这样做:
input[type=submit] {
// properties
}
It's a very useful for styling form buttons.这对于样式化表单按钮非常有用。
How do you do the same thing in SASS?你如何在 SASS 中做同样的事情?
You can also nest it like this你也可以这样嵌套
input
&[type="submit"]
....
&[type="search"]
....
This converter website says:这个转换器网站说:
input[type=submit]
// properties
I use the one below in my project.我在我的项目中使用下面的一个。
.bg-brand-3 {
background-color: black;
&[type="button"]:enabled {
&:hover {
background-color: orange;
}
&:active {
background-color: green;
}
}
&[type="submit"] {
// css
}
}
The :enable
has the same meaning as :not(:disabled)
:enable
与:not(:disabled)
含义相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.