SCSS / CSS选择器来选择所有输入类型 [英] SCSS/CSS selector to select all input types

查看:1078
本文介绍了SCSS / CSS选择器来选择所有输入类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些输入类型有这个scss设置(从框架)

I have some input type has this scss setting (from the framework)

textarea,
input[type="text"],
input[type="password"],
input[type="datetime"],
...
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"],
{
  @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
}

我喜欢覆写/复位全部,类似

I like to override/reset all, something similar

textarea,
input[type="*"],
{
  @include box-shadow(none);
}

不起作用,

textarea,
    input,
    {
      @include box-shadow(none);
    }

不够具体。是否有办法比列出所有可能的类型。

not specific enough. Is there a way to do this than listing all possible types.

谢谢。

推荐答案

有很多可能的输入类型。如果你想要textareas和任何输入的类型属性,然后...

There are a lot of possible input types. If you want textareas and any input that has a type attribute then...

textarea,
input[type] {
    ...
}

如果要排除某些输入类型然后使用:not 选择器。
编辑示例JSFIDDLE http://jsfiddle.net/Pnbb8/

If you want to exclude some input types then use the :not selector. EDIT EXAMPLE JSFIDDLE http://jsfiddle.net/Pnbb8/

textarea,
input[type]:not([type=search]):not([type=url]):not([type=hidden]) {

}

可能是更多的类型,你不想要的类型,你所需要的,所以你不能真正避免的列表。

But like I said there are probably a lot more types you DON'T want than types you DO want, so you can't really avoid the list.

你可以总是使用CSS类。

You could always use a CSS class instead.

.box-shadowed
{
  @include box-shadow(none);
}

这篇关于SCSS / CSS选择器来选择所有输入类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆