开发者

Different input text style and submit button style in CSS

开发者 https://www.devze.com 2023-02-26 04:47 出处:网络
I used #forms input { padding:0.15em; height:1.5em; border:1px solid #ddd; background:#fafafa; font:bold 0.95em arial, sans-serif;

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 st开发者_StackOverflow中文版yle to submit button.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消