操纵css不影响所有元素

  • 本文关键字:元素 影响 css 操纵 css
  • 更新时间 :
  • 英文 :


这个css的东西让我抓狂。

我有一个表格,我放了以下css脚本:

input, select, textarea
{
    color: #082C6B;
    padding: 0px;
    font-family: Arial;
    font-size: 12px;
}

在表格中,我还按下了以下按钮:

<asp:Button ID="btnSend" runat="server" class="myButtonText" Style="font-size: 22px; float: left; height: 30px; width: 100px;" OnClick="btnSend_Click" CausesValidation="true" Text="send" />

我还放了以下css脚本:

.myButtonShape
{
    /* fallback */
    background-color: #082c6b;
    /*background: url('../images/gradient-strip.png');
    background-repeat: repeat-x;*/ /* Safari 4-5, Chrome 1-9 */
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#53e0ff), to(#081a40)); /* Safari 5.1, Chrome 10+ */
    background: -webkit-linear-gradient(top, #53e0ff, #081a40); /* Firefox 3.6+ */
    background: -moz-linear-gradient(top, #53e0ff, #081a40); /* IE 10 */
    background: -ms-linear-gradient(top, #53e0ff, #081a40); /* Opera 11.10+ */
    background: -o-linear-gradient(top, #53e0ff, #081a40);
    /*border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 10px;*/
    text-align: center;
    cursor: pointer;
    color: #cccccc;
    text-decoration: none;
}

现在,由于asp:button被翻译成input。。。然后按钮获得我为字段数据准备的脚本的颜色。如何确保按钮将获得".myButtonShape"类的脚本?有什么想法吗?

提前感谢。

尝试在<asp:Button>上正确设置class。现在它被设置为myButtonText,所以myButtonShape的样式当然不会应用于它。

您可以使您的输入css针对特定类型的输入,而不是像这样的所有输入:

input[type="text"], select, textarea
{
    color: #082C6B;
    padding: 0px;
    font-family: Arial;
    font-size: 12px;
}

您的存在于类设置为myButtonShape的中吗?如果是这样的话,我认为它应该起作用。如果仍然没有,请尝试使用上面CSS中的!important属性。

最新更新