Keeping css drop down menu item highlighted with php?

OK, quick and dirty answer : your CSS selector won't work, because right now it search for a tag "donate" inside a "a" tag inside a tag with the id "menu". I assume all your link have a specific Id, so the easy way to do it is to use this selector donate { color: #000; background: #fff; text-decoration: none; } As an added bonus, this selector will be faster to parse by the browser By the way, you seem not to close the style tag. Is that an error?

Now, for a longer answer, it is not exactly the best way to do it. I suggest you create a CSS class with a name like "currentpage" and to use it like this in your menu li> id="donate" href="index2. Php?

Op=Donate">DonateId does the job just fine.

OK, quick and dirty answer : your CSS selector won't work, because right now it search for a tag "donate" inside a "a" tag inside a tag with the id "menu". I assume all your link have a specific Id, so the easy way to do it is to use this selector #donate { color: #000; background: #fff; text-decoration: none; } As an added bonus, this selector will be faster to parse by the browser. By the way, you seem not to close the style tag.Is that an error?

Now, for a longer answer, it is not exactly the best way to do it. I suggest you create a CSS class with a name like "currentpage" and to use it like this in your menu id="donate" href="index2. Php?

Op=Donate">Donate That way you can keep your style in the stylesheet where it will be easier to maintain. Now of course, if all your menu tags are handcoded, you may find it pretty tedious to add the condition in everytag. If it's indeed the case, I suggest you create your menu using a loop.

By the way, you should remove the name attribute in the a tag, its a deprecated feature. Id does the job just fine.

I think you need to use if($head == "Donate") { echo ''; } as a selector instead, because donate is an id for the a tag, therefore it comes immediately after the a tag (no spaces) with a "#" in front. You were also missing a "}" closing bracket for the css declaration.

In this kind of situations, you will generally use a CSS class for the currently highlighted item : Current item not current item This way, you won't change the id nor name nor anything else -- but just : When an item is highlighted, add the css class And when an item is un-highlighted, remove the css class. That class can be added from Javascript, if necessary -- but it can also be generated from PHP, using something like this : ...>Current item ...>not current item.

Usgin css you can try like this: #menu a:active { color: #000; background: red: text-decoration: none; } using jquery this can be done as following: First create a css like below: . Active { color: #000; background: red: text-decoration: none; } then write jquery code: $('#menu a'). Click(function(){ $('#menu ul li h2').

Find('a. Active'). RemoveClass('active'); $(this).

AddClass('active'); }).

You should set a class for the current page item using php, and use css to set rules for that class.

Now of course, if all your menu tags are handcoded, you may find it pretty tedious to add the condition in everytag. If it's indeed the case, I suggest you create your menu using a loop. By the way, you should remove the name attribute in the a tag, its a deprecated feature.

Id does the job just fine.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions