Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

CSS style

Dear Experts,
I have a left vertical menu. What I want is that when I'm at the related page, the assosiated box should have diffrent background color and the font color should be also diffrent than others. How can I do that? thank you

My code is here.
#menusol {
	margin:0;
	padding:0;
}

#menusol ul{
	width: 198px;
	margin:0;
	padding:1px;
	border:1px solid #d7e3e5;
}
#menusol li{
	display:marker;
	list-style:none;
	padding-bottom:1px;
}
#menusol li a{
	display:block;
	font:.75em Arial, Geneva, sans-serif;
	font-size:12px;
	font-weight:normal;
	text-align:left;
	color:#FFF;
	text-decoration:none;
	background-color:#0D4B64;
	padding:5px;
	border-left:0px solid #F1AEB6;
}
#menusol li a:hover{
	color:#0D4B64;
	border-left:0px solid #F1AEB6;
	background-color:#FFF;
	font-weight:normal;
}

Open in new window

Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

there are lots of different ways of doing that. Depending on how your site is built some may be better than others. you can do it server side, with javascript, or with css alone. which is better for your site depends on how your site is built.
A simple (none php solution) might be to give the body tag of each page its own id, then allocate a style according to each specific page.
For example if a page has a body id called <body id="somePage">
its style might look something like this:
#somePage #menusol li a{
      color:red;
}
Essentially, each page would have its own style.
This way would work however php has some much more efficient solutions for applying current page styles to links.
Cheers,
N
Avatar of BR

ASKER

I think I haven't explain it clearly.
what I want is to give different background and font color to one of the box of my menu.
There will be no link on this box. Because the user will be already on this page. Thank you
SOLUTION
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

dear kozaiwaniec
that is the anwser that I'm looking for.
However, I don't want to use .active
can I do that like this? copy the complete code, give a different name to css and apply the box that I want to be seen in different color.
im not sure i understand your question.

you dont want to have duplicate css files - you'll give yourself a nightmare trying to maintain that.

why dont you want to use 'active'? Do you want different colors for different boxes? if so, just give them different classes.

can you provide a link to your page?
Avatar of BR

ASKER

dear kozaiwaniec

please check this page
http://www.real.com.tr/Oto_Cocuk_Koltugu.html 
as you can see on the left menu, one of the link has red color which shows that they are on the related page.
that is what I'd like to do with the above code. I will modify every page on the menu whic is ok for me.
thank you
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you have been provided a number of options. it's not clear at this point what you are asking for if you cant use those options.

you need to provide a link to YOUR page if you want a 'copy and paste' solution.
Avatar of BR

ASKER

Dear kozaiwaniec
my menu is here
http://www.alaramalaz.com/Untitled-1.html
I want one of the menu link color be diffrent than the others. That will show the users that they are on that page. thank you
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I completely agree with kozaiwaniec.
N
Avatar of BR

ASKER

thank you