2

I have these two in my html code:

<input class="input1" type="text" size="15" name="login">
<input class="input1" type="submit" value="Send">

In CSS I have styles for .input1 and input.input1:

.input1 {
//something
}
input.input1 {
//something
}

And now I would like change style only for buttons (type submit) and keeps style for inputs type text. How can I do that? I tried in CSS with submit.input1 { and button.input1 { but this is not working.

2 Answers 2

5

Try

input[type=submit] { /* your code here*/ }

or

input.inputbox[type=submit] { /* your code here*/ }
Sign up to request clarification or add additional context in comments.

7 Comments

Note: IE6 won't understand this.
Thanks for help. Is there any other way to do that for IE6 as well (without js)?
@bazmegakapa True, as won't Netscape Navigator or Lynx, but we're not talking about mummies here (not referencing Lynx as a "mummy"). You are correct, nevertheless :)
@Lucas no solution that I know without butchering your code, but IE6 has 1.8% market share as of September 2011, and dropping. I'm not telling you how to go forward, but in my opinion, this Beelzebub-among-browsers should be left to succumb.
@George It's an old debate going on, nevertheless, projects still exist where you need to support IE6. Certain countries, certain audiences still have a high usage rate. Unfortunately.
|
1

You can specify attributes in selectors like so .input1[type="submit"]

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.