2012-04-13 2 views
-1

それらを変更する方法は?私はこれをしようとしましたが、彼らはdivのCSSでdivでbtnsする必要がありますか、ボタンがIDを持っている必要がありますか?私はこれらのボタンが好きですが、ユニークなID(またはクラス)のボタンにしか影響を及ぼさないようにする必要があります。[タイプ= ""]

<pre><code> 
<html> 
<head> 
<style type="text/css"> 

input[type="submit"], input[type="button"] { 
    -moz-border-radius: 10px; 
    -webkit-border-radius: 10px; 
    border-radius: 10px; 
} 

input[type="submit"], input[type="button"] { 


float: right; 
    margin: 2em 1em 0 1em; 
    width: 10em; 
    padding: .5em; 
    border: 1px solid #666; 
    -moz-border-radius: 10px; 
    -webkit-border-radius: 10px; 
    border-radius: 10px; 
    -moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8); 
    -webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8); 
    box-shadow: 0 0 .5em rgba(0, 0, 0, .8); 
    color: #fff; 
    background: #0a0; 
    font-size: 1em; 
    line-height: 1em; 
    font-weight: bold; 
    opacity: .7; 
    -webkit-appearance: none; 
    -moz-transition: opacity .5s; 
    -webkit-transition: opacity .5s; 
    -o-transition: opacity .5s; 
    transition: opacity .5s; 
} 

input[type="submit"]:hover, 
input[type="submit"]:active, 
input[type="button"]:hover, 
input[type="button"]:active { 
    cursor: pointer; 
    opacity: 1; 
} 

input[type="submit"]:active, input[type="button"]:active { 
    color: #333; 
    background: #eee; 
    -moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset; 
    -webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset; 
    box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset; 
} 

input[type="button"] { 
    background: #f33; 
} 
</style> 


</head> 
<body> 

    <div id="formButtons"> 
    <input type="submit" id="sendMessage" name="sendMessage" value="Reply" /> 
    <input type="button" id="cancel" name="cancel" value="Cancel" /> 
    </div> 

</body> 
</html> 


</code></pre> 

答えて

0

これはあなたの質問ですか?

#yourIdHere{ /* impacts only ID */ } 

.yourClassHere{ /* impacts only elements with class */ } 

INPUT.yourClassHere{ /* impacts only inputs with class */ } 

CSSはセレクターの豊富なセット(その多くは組み合わせることができます)を提供します:あなたは、CSSを適用する場合はhttp://www.w3.org/TR/selectors/#selectors

1

を使用すると、すべてのボタンにCSSを適用する必要がある場合

input[type="button"] 
{ 
    /* CSS property */ 
} 

特定のボタンに入力する必要はありません。[type = "button"]、クラスまたはIDを使用してください。

.special_button 
{ 
    /* my css property */ 
} 

または

#special_button 
{ 
    /* my css property */ 
} 
関連する問題