我的母版页中有一个用户控件。在 IE7(或 IE8 兼容模式)下查看时,它会在 ContentPlaceHolders 的页面内容后面呈现。我尝试手动设置每个元素的 z-index,但没有一个会将控件放在前面。有人遇到过这种情况么?它适用于 Chrome、Firefox、Safari 和 IE8 不兼容。
正如其他地方所建议的那样,我将母版页中的文档类型更改为以下内容,但这没有用。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
从母版页:
<%@ Register Src="controls/UserInfo.ascx" TagName="UserInfo" TagPrefix="uc1" %>
<div class="head-links">
<uc1:UserInfo ID="UserInfo1" runat="server" />
</div>
从用户控制:
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Width="233px" style="z-index: 1000" >
<p>Are you sure? Your current shopping cart is valid only for the current Dealer ID. Switching Dealer IDs will reset your cart according to the new Dealer ID chosen.</p>
<br />
<div align="center" style="z-index:99">
<asp:Button ID="OkButton" runat="server" Text="Ok" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
</div>
</asp:Panel>
和CSS:
.modalPopup {
background-color:white;
border-width:1px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
.head-links
{
position: absolute;
top: 0px;
right: 70px;
text-align: left;
width: 170px;
}
.head-links a
{
color: #fff;
text-decoration: underline;
}
.head-links a:hover
{
color: #fff;
text-decoration: none;
}