I like to know if CSS can be used to highlight the CSS nav menu if the current page is the page that the menu links to. For example, the folowing code is my side bar navigation menu.

#lftSideMenu {
	float: left;
	width: 165px;
	margin: 0 0px 0 0;
	background-color: #FFFFFF;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	padding-bottom: 5px;
	padding-left: 5px;
	}
#lftSideMenu ul {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	list-style-type: none;
	margin-left: 0px;
	padding-left: 0px;
	color: #000066;
	font-weight: bold;
	}
#lftSideMenu li {
	margin: 0px;
	padding: 0px;
	}
#lftSideMenu A:link{
	padding: 0px 0px 0px 5px;
	text-decoration: none;
	display: block;
	width: 100%;
	margin: 0px;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #000000;
	}
#lftSideMenu A:visited{
	padding: 0px 0px 0px 5px;
	text-decoration: none;
	display: block;
	width: 100%;
	margin: 0px;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #000000;
	color: #0000CC;
	}
#lftSideMenu A:hover{
	font-weight: bold;
	background-color: #FFCC99;
	color: #000033;
	text-decoration: none;
	margin: 0px;
	padding: 0px 0px 0px 5px;
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #000000;
	}
#lftSideMenu A:active {
	background-color: #FF6600;
	}

How do add to this or modify this code so that the nav menu will be hightlighed if the use is on that current page?

Your help is appreciated.

ljCharlie

Recommended Answers

All 3 Replies

Generally, if your description of the functionality relies on the word 'if', you probably need some form of conditional, which CSS doesn't natively provide. You're looking at a PHP/CSS or Javascript hack as your best option.

Thank you for your response. I guess I'll have to seek other alternatives then.

ljCharlie

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.