Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS LINK STYLES

Featured Replies

a.logo:link {color: #ffffff; text-decoration: none}

a.logo:visited {color: #ffffff; text-decoration: none}

a.logo:hover {color: #ffcc00; text-decoration: none}

a.logo:active {color:#ffff00; text-decoration: none}

 

I used the above codes for the links on my site banner, the idea is that the active link - ie the link that leads to the current the page should be different from the other, but it doesn't work. It just shows the color briefly and returns to the default. I would appreciate any suggestions on how to do this.

a.logo:link {color: #ffffff; text-decoration: none}

a.logo:visited {color: #ffffff; text-decoration: none}

a.logo:hover {color: #ffcc00; text-decoration: none}

a.logo:active {color:#ffff00; text-decoration: none}

 

I used the above codes for the links on my site banner, the idea is that the active link - ie the link that leads to the current the page should be different from the other, but it doesn't work. It just shows the color briefly and returns to the default. I would appreciate any suggestions on how to do this.

 

Have you got a link

I do this by applying a class to the current link (the link that corresponds with the page).

 

Here's an example from one of my old sites:

 

<li><a class="current" href="index.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="comments.php">Comments</a></li>
<li><a href="latestproject.html">Latest Project</a></li>
<li><a href="contactus.html">Contact Us</a></li>

 

The page this link set was on was the index.html page. I applied a class called "current" to the index.html link, and then styled it up so it was different from the other links:

 

#nav {padding:0 0 10px 15px;}
#nav li {display:inline; margin:0; padding:0 15px 0 0; border:0; background-image:none;}
#nav li a {color:#fff; font-size:14px; font-weight:700;	text-decoration:none;}
#nav li a:hover {color: lime;}
--->  #nav li a.current {color:orange}<---

 

Applying the same principle to your links, you should be able to do the same.

The :active doesn't show permanently so can't be used to highlight the current page, it is supposed to work only when you press the mouse button over a link as in Firefox, but IE is different and will retain the highlight if you've moved to the page in the link and then use the back button to go back to the original page where the link will still be highlighted (but this is IE being incorrect).

 

As said, you need a separate class .current to highlight the current page link permanemtly while looking at the page, to tell users that you are on that page, as some websites have lots of pages that are similar and you need to know which you are looking at.

 

To save you coding every page menu with the class="current" in a different "a" tag, you can use the matched pairs principle so that all the li tag coding sequence is the same on every page and a page id or class only matches one of the links, and so only highlights the page link where the page id or class matches just one of the li classes. You can also use PHP to identify the page and change the style. See

http://www.wickham43.net/highlighthome.php

second, third or fourth example as the first is the one which requires every page to have a different menu style, which can make editing many pages later time consuming.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.