2017-07-18 41 views
1

我有一个非主页,看起来像这样
Login为什么没有一些CSS属性出现在我的母版页中?

现在我有一个母版页和内容占位里面我有一个div标签,在我写的具体内容上的按钮页时,标签上的按钮看起来像这样

enter image description here
现在,他们具有相同的CSS属性,但他们不会在母版页一个显示出来,这里是div标签的代码和按钮

.container-div 
{ 
    position:absolute; 
    padding-top:8%; 
    padding-left:10%; 
    padding-right:10%; 
    max-height:80%; 
    z-index:0; 
    font-family:Calibri; 

} 

#buttons { 
    position:absolute; 
    display: inline-block; 
    padding: 6px 12px; 
    margin-bottom: 0; 
    font-size: 14px; 
    font-weight: normal; 
    line-height: 1.428571429; 
    text-align: center; 
    white-space: nowrap; 
    border: 1px solid transparent; 
    border-radius: 4px; 
    cursor:pointer; 
    z-index:20; 
} 

#buttons:hover { 
    background-color:cadetblue; 
} 

,这是HTML代码

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> 

<div id="placeHolderDiv" class="container-div" runat="server"> 

    <asp:Button id="buttons" runat="server" Text="Cancel" CssClass="buttons" OnClick="cancel"/> 


</div> 

+0

“这是html代码” - 不,它不是。这是ASP.NET代码。 HTML是发送到浏览器的内容。查看浏览器*中的源代码*。 – Quentin

回答

2

变化CSS类从#buttons到由于主页下.buttons 生成的ID将是不完全按钮,但会有ID制备型结束。你可以检查来源。

.buttons { 
    position:absolute; 
    display: inline-block; 
    padding: 6px 12px; 
    margin-bottom: 0; 
    font-size: 14px; 
    font-weight: normal; 
    line-height: 1.428571429; 
    text-align: center; 
    white-space: nowrap; 
    border: 1px solid transparent; 
    border-radius: 4px; 
    cursor:pointer; 
    z-index:20; 
} 

.buttons:hover { 
    background-color:cadetblue; 
} 
+0

工作的Thankyou! –

-1

一些编译器有与解析多个元素用相同的硬id时间,ID应唯一身份。

更改为“类=按钮”和CSS选择到.buttons{};

相关问题