Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking hover color stay if link is active
    primarykey
    data
    text
    <p>I'm working on a website using PHP, HTML and CSS. Currently in my navigation bar, I've set the background color to be grey. When the user hovers over the navigation bar, each link gets a blue background, however when I click the link, the background color goes back to grey. How do I make the hover color blue stay if that particular link is active.</p> <p>This is the code for my navigation bar. </p> <pre><code>&lt;tr&gt; &lt;td width="800" height="54"&gt; &lt;div id="nav" &gt; &lt;ax&gt;&lt;b&gt;&lt;font face="Arial" &gt;&lt;a style="text-decoration: none; color:#303030" href="index.php" &gt;HOME&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/ax&gt; &lt;bx&gt;&lt;b&gt;&lt;font face="arial" &gt;&lt;a style="text-decoration: none; color:#303030" href="edituser.php?own=y"&gt;IT&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/bx&gt; &lt;cx&gt;&lt;b&gt;&lt;font face="arial" &gt;&lt;a style="text-decoration: none; color:#303030" href="newsevents.php"&gt;HUMAN RESOURCE&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/cx&gt; &lt;dx&gt;&lt;b&gt;&lt;font face="arial" &gt;&lt;a style="text-decoration: none; color:#303030" href="industries.php"&gt;PROCUREMENT&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/dx&gt; &lt;ex&gt;&lt;b&gt;&lt;font face="arial" size="1"&gt;&lt;a style="text-decoration: none; color:#303030" href="http://www.csmphilippines.com/aboutus.html"&gt;FINANCE&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/ex&gt; &lt;fx&gt;&lt;b&gt;&lt;font face="arial" &gt;&lt;a style="text-decoration: none; color:#303030" href="hact.php"&gt;HACT&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;&lt;/fx&gt; &lt;/div&gt; &lt;/td&gt; </code></pre> <p></p> <p>This is the code for my CSS</p> <pre><code>#nav { text-decoration:none; padding-bottom:10px; border-bottom:none; width: } #nav ax { display:inline; padding:15px; padding-left:31px; padding-right:28px; background-color:#ececec; text-decoration:none; } #nav bx { display:inline; padding:15px; padding-left:45px; padding-right:45px; background-color:#ececec; text-decoration:none; } #nav cx { display:inline; padding:15px; padding-left:45px; padding-right:45px; background-color:#ececec; text-decoration:none; } #nav dx { display:inline; padding:15px; padding-left:45px; padding-right:45px; background-color:#ececec; text-decoration:none; } #nav ex { display:inline; padding:15px; padding-left:53px; padding-right:53px; background-color:#ececec; text-decoration:none; } #nav fx { display:inline; padding:15px; padding-left:30px; padding-right:30px; background-color:#ececec; text-decoration:none; } #nav ax:hover { background-image:url(images/tabbackit.jpg); background-repeat:repeat-x; height:900px; } #nav bx:hover { background-image:url(images/tabbackit.jpg); background-repeat:repeat-x; height:900px; } #nav cx:hover { background-image:url(images/tabback.jpg); background-repeat:repeat-x; height:900px; } #nav dx:hover { background-image:url(images/tabbackproc.jpg); background-repeat:repeat-x; height:900px; } #nav ex:hover { background-image:url(images/tabbackfin.jpg); background-repeat:repeat-x; height:900px; } #nav fx:hover { background-image:url(images/tabbackhact.jpg); background-repeat:repeat-x; height:900px; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload