【发布时间】:2015-02-26 12:21:38
【问题描述】:
我正在开发一个垂直导航 Web 应用程序。当我单击超链接(存在于母版页中)时,会加载子 .aspx 页面,但由于它是新页面加载,因此设置了超链接的默认颜色。我想为加载的相应页面的超链接设置不同的颜色。
母版页代码:
<header id="leftpanel">
<ul>
<li><a href="Default.aspx">Home</a></li><br />
<li><a href="Default2.aspx">About Us</a></li><br />
<li><a href="Default3.aspx">Tourism</a></li><br />
<li><a href="Default4.aspx">Enquiry</a></li><br />
</ul>
</header>
<div id="mainpanel">
<asp:Label ID="lblTitle" runat="server" Text="MAIN TITLE"></asp:Label>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
代码的CSS:
body {
top:0;
left:0;
margin:0;
}
#leftpanel{
position:fixed;
left:0;
width:25%;
float: left;
height:100%;
background-color: gray;
text-align:center;
padding-top:250px;
}
ul, li{
padding:0;
margin:0;
list-style:none;
}
#leftpanel ul li{
font-size:15px;
line-height:15px;
letter-spacing:3px;
color:white;
margin-bottom:20px;
-webkit-font-smoothing:antialiased;
-webkit-transition:color 0.3s ease-out;
font: 20px/1.4em "PT Sans Narrow", "Arial", sans-serif;
}
#leftpanel ul li a{
color:white;
-webkit-transition:color 0.3s ease-out;
-moz-transition:color 0.3s ease-out;
-o-transition:color 0.3s ease-out;
-ms-transition: color 0.3s ease-out;
transition:color 0.3s ease-out;
font-weight:bold;
text-decoration:none;
background-color:gray;
cursor:pointer;
}
#leftpanel ul li:hover, #leftpanel ul li a:hover , #leftpanel ul li.current{
color:#0fe9bd;
-webkit-transition:color 0.3s ease-out;
-moz-transition:color 0.3s ease-out;
-o-transition:color 0.3s ease-out;
-ms-transition: color 0.3s ease-out;
transition:color 0.3s ease-out;
cursor:pointer;
}
#leftpanel a:hover, #leftpanel .active{
color:#0fe9bd;
font:x-large
}
#mainpanel{
position:fixed;
width:75%;
float:left;
left:25%;
height:100%;
text-align:center;
align-items:center;
background-color:#0fe9bd;
color:black;
font-weight:bold;
font: 20px/1.4em "PT Sans Narrow", "Arial", sans-serif;
}
另外,如果我在母版页的内容占位符中放置一个更新面板,如何在单击超链接时将子页面加载到更新面板中,而不是重新加载整个页面?
【问题讨论】:
-
你能用ajax吗?
-
@jbutler483:我没有机会这样做。但是,页面似乎可以正常打开,没有任何错误。
标签: css asp.net master-pages parent-child