Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为什么不';我的母版页中没有出现一些css属性吗?_Html_Css_Asp.net - Fatal编程技术网

Html 为什么不';我的母版页中没有出现一些css属性吗?

Html 为什么不';我的母版页中没有出现一些css属性吗?,html,css,asp.net,Html,Css,Asp.net,我在非母版页上有一个按钮,看起来像这样 现在我有了一个母版页,在内容占位符中有一个div标记,我在其中写入特定页面的内容,该标记中的按钮如下所示 现在它们具有相同的css属性,但它们不会显示在母版页1中,下面是div标记和按钮的代码 .container-div { position:absolute; padding-top:8%; padding-left:10%; padding-right:10%; max-height:80%;

我在非母版页上有一个按钮,看起来像这样

现在我有了一个母版页,在内容占位符中有一个div标记,我在其中写入特定页面的内容,该标记中的按钮如下所示


现在它们具有相同的css属性,但它们不会显示在母版页1中,下面是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>


一些编译器在解析具有相同id的多个元素时遇到困难,id应该是唯一的

更改为“class=buttons”,css选择器更改为
.buttons{}

将CSS类从#按钮更改为.button 因为母版页下生成的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;
}
“这是html代码”-不,不是。这是ASP.NET代码。HTML是发送到浏览器的内容。在浏览器中查看源代码。