Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCSS/CSS selector to select all input types

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); } 

above doesn't work, Also

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

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

Thanks.

like image 524
bsr Avatar asked Aug 06 '13 16:08

bsr


People also ask

How do I select all input types in CSS?

Element Selectors The selector "input[type=text]" means select all inputs with the type attribute equal to text.

How do I select all elements in SCSS?

The * selector selects all elements. The * selector can also select all elements inside another element (See "More Examples").

What is the correct selector for targeting all text inputs?

CSS attribute selector is used to targeting an input text fields. The input text fields of type 'text' can be targeting by using input[type=text].

How do I target a specific input type in CSS?

If you only want to style a specific input type, you can use attribute selectors: input[type=text] - will only select text fields. input[type=password] - will only select password fields. input[type=number] - will only select number fields.


1 Answers

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

textarea, input[type] {     ... } 

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.

You could always use a CSS class instead.

.box-shadowed {   @include box-shadow(none); } 
like image 134
Louis Ricci Avatar answered Sep 23 '22 06:09

Louis Ricci