0

Can I define style in CSS for input with attribute selectors and a class also?

input[type=text].focus

The above css does not work. But is there any way to achieve this?

2 Answers 2

7

try input[type="text"].focus (with quotes around attribute value)

example fiddle: http://jsfiddle.net/dn3wU/

Anyway also that specific unquoted value should work, as stated here

A valid unquoted attribute value in CSS is any string of text that is not the empty string, consists of escaped characters and/or characters matching /[-_\u00A0-\u10FFFF]/ entirely, and doesn’t start with a digit or two hyphens or a hyphen followed by a digit.

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

Comments

2

Try this:

input[type=text]:focus

Comments

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.