1

I used

#forms input {
    padding:0.15em;

    height:1.5em;
    border:1px solid #ddd;
    background:#fafafa;
    font:bold 0.95em arial, sans-serif;
    -moz-border-radius:0.4em;
    -khtml-border-radius:0.4em;
}

but it produces the same style to both input text box and submit button. I want to give different style to submit button.

1 Answer 1

6

You have three options:

1. A class

Give the button a class attribute, and style that separately.

<input class="button">

You can address that using

 #forms input.button { ... } 

2. Use a different element

use the <button> element:

<button>OK</button>

you can address that using

#forms button { ... } 

3. Selector

use the type selector:

    #forms input[type="button"]  { ... } 

however, that doesn't work in IE6.

I would go with the first or second one.

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

3 Comments

why not #forms input.submitButton{/* css */} where submitButton will be the class name for the button?
sorry your modified answer showed up only when I posted the comment.
If button can't be used for whatever reason, Modernizr can add support for input[type='...'] selectors to IE6: modernizr.com

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.