I have a problem when creating a menu using CSS. The problem is that I would like to use: active so that my current button is highlighted. But after trying many times, I still cannot find how to implement it in my code.
I use the <li> tag inside the <a> tag to make sure that the button color and text color change when I select it, because after trying to place the <a> tag outside the <li> tag, the text color does not change when the button is selected, the text only changes after entering the cursor in the text.
You need your help.
This is my CSS code:
a, body { margin-top:-30px; text-decoration:none; }
and this is my html code:
<div id="topmenu"> <ul> <img src="includes/menu/pics.gif" alt="" style="float:left;"/> <a href="../folder/home.php"><li id="home">Home</li></a> <a href="../folder/A.php"><li>A</li></a> <a href="../folder/B.php"><li>B</li></a> <a href="../folder/C.php"><li>C</li></a> <a href="../"><li id="logout">Logout</li></a> </ul> </div>
source share