Aryan G
Aryan G

Reputation: 1301

Different input text style and submit button style in CSS

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.

Upvotes: 1

Views: 6604

Answers (1)

Pekka
Pekka

Reputation: 449435

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.

Upvotes: 6

Related Questions