我写了这个CSS:
.form-group > input[type="text"],
.form-group > input[type="text"]:hover,
.form-group > input[type="text"]:active,
.form-group > input[type="password"],
.form-group > input[type="password"]:hover,
.form-group > input[type="password"]:active,
.form-group > input[type="email"],
.form-group > input[type="email"]:hover,
.form-group > input[type="email"]:active {
max-width: 400px;
}
我知道可以通过编写代码来缩短这段文字
.form-group > input[type="text"],
.form-group > input[type="password"],
.form-group > input[type="email"] {
max-width: 400px;
&:hover,
&:active {
}
}
嗯,第二部分代码是我真正编写的,第一部分只是为了提问的戏剧效果,我猜测;)
现在我想知道是否有一种功能可以将输入类型选择器进行分组,类似于这样:
.form-group > input {
$:text,password,email
max-width: 400px;
&:hover,
&:active {
}
}