0

Is there a CSS3 selector like jQuery's :input which returns all input fields: select, input, textarea and button?

Even a browser-specific implementation would be fine, as long as it's CSS-only.

2 Answers 2

6

Not directly, no. However you can work around this with the :enabled and :disabled selectors:

:enabled, :disabled {
    ...
}

JSFiddle demo.

Sign up to request clarification or add additional context in comments.

1 Comment

Disappointing that it's not part of any draft, but the :enabled property seems to be perfect for my situation. To clarify, the enabled property only applies to <button>, <input>, <optgroup>, <option>, <select>, and <textarea> - which is perfect
0

You can try to use:

textarea, input[type] {
    /* Your styles here */
}

Above selector will applied to all textareas and any input that has a type attribute.

1 Comment

Inputs without a type default to text — specifying that the input must have an explicit type attribute isn't really helpful in the context of the OP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.