下面的代碼是我到目前爲止我的css按鈕的配置,它現在顯示的是正常按鈕。但是,如果我切換到id而不是class,它確實有效。爲什麼我的asp按鈕(input type =「submit」)對我的css類沒有反應?
.phasesButton [type=submit]
{
clear:both;
display:block;
margin-left: auto;
margin-right: auto;
width:125px;
height:31px;
background:rgba(0,0,0, .7);
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:13px;
font-weight:bold;
margin-top:30px;
border: 1px solid #000000;
box-shadow: 0 1px 2px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .5);
cursor: pointer;
}
這是我的HTML
<div id="phaseOne" class="frmPhaseOne">
<table width="95%">
.
.
.
</table>
<asp:Button ID="btnPhaseOne" class="phasesButton " runat="server" Text="Submit"/>
</div>
即使我把按鈕股利外,或將input[type=submit]
相反,它仍然是行不通的。
設置改爲使用CssClass屬性的CSS類。 –
@KingKing如果屬性值中沒有特殊字符,我相信引號是不必要的。雖然它們也不會傷害它們。 –
@FabrícioMatté是的,我習慣於添加引號,因爲這是一個非常好的做法,不使用引號是某種不好的做法,應該避免。 –