Visual Studio Css Menu  master page

rflorencio
rflorencio used Ask the Experts™
on
After some research on the Internet I found this code for css menu. It´s all i need, but i need when select a menu option element selected (for ex. default.aspx) to be in a different color. In this moment only when mouse over the menu, the element is blue.       
What element should add so can add this feature.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Master Language="VB" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
 
<head runat="server">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>HomeProdutosServicosSoftwareInfo</title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
#menu {
	background: #333;
	float: left;
	list-style: none;
	margin: 0;
	padding: 0;
	width: 100%;
}
#menu li {
	float: left;
	font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
	margin: 0;
	padding: 0;
}
#menu a {
	background: #333 url('menu/images/seperator.gif') no-repeat right bottom;
	color: #ccc;
	display: block;
	float: left;
	margin: 0;
	padding: 8px 12px;
	text-decoration: none;
	font-weight:normal;
}
</style>
</head>
 
<body>
 
<form id="form1" runat="server">
 
<table style="width: 100%">
	<tr>
		<td>&nbsp;</td>
		<td>
		   <ul id="menu" style="width: 48%">
		   <li><a href="Default.aspx" target="_self">Home</a></li>
		   <li><a href="Produtos.aspx" target="_self">Produtos</a></li>
		   <li><a href="Servicos.aspx" target="_self">Servicos</a></li>
		   <li><a href="Software.aspx" target="_self">Software</a></li>
		   <li><a href="Informacao.aspx" target="_self">Informacao</a></li>
		   <li><a href="Destaque.aspx" target="_self">Destaque</a></li>
		   <li><a href="Contactos.aspx" target="_self">Contactos</a></li>
           </ul>
		</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>
		<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
		</asp:ContentPlaceHolder>
		</td>
		<td>&nbsp;</td>
	</tr>
</table>
 
</form>
 
</body>
 
</html>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
#menu a:active
{
 color:#ff0000;
}

Author

Commented:
With this css code only when click in menu link element the font is red, after browser reload page menu stay gray again and unchanged.
Britt ThompsonSr. Systems Engineer
Top Expert 2009
Commented:
To do what you're trying to accomplish the CSS has to be included within the tags of the HTML and a function created to display what you want. I only know how to do this in PHP and not ASP.

In php it's be something like <li><a <?php if ($_GET['id'] == thepageid) { echo style='color: #ccc;' } ?> href="Default.aspx" target="_self"....

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial