June 24, 200917 yr I'm possibly being quite dumb here but I have the following problem I'm hoping you can help me with. I have a menu built in CSS with link, hover, visited, etc. Am I right in assuming the 'active' link will control the appearance of a link when a visitor is on that particular page? For example, the menu is in a blue font and when the visitor goes to the 'about us' page, I can set the link in the menu for 'contact us' to turn red using the active element in CSS? I have tried to use the 'active' element but it doesn't change the link colour for an 'active' page. Am I misinterpreting the use of the 'active' element and if so, how do I achieve the effect of having the current page link highlighted in a different colour? Thanks in advance.
June 24, 200917 yr Active means when the user has clicked on the link. Don't forget that in your CSS it needs to be in the following order: a:link{ } a:visited { } a:hover{ } a:active { } Take a look at the W3Schools website for more information.
June 24, 200917 yr Also - if you want an OnPage type of link you can use a.onpage { } and then in your html use <a href="#" class="onpage">Link</href>
June 24, 200917 yr Browsers treat the active state differently. Read this:- http://www.wickham43.net/generaladvice.php#links Most only show the active state while pressing the mouse button, not afterwards, (ie only while it is active) but IE retains the active state after you use the back button to return to the page you clicked on a link. What you want may need is focus to identify the link that is active (to go to) next time you click Enter (useful for disabled people or screen readers), which again is treated differently because IE doesn't support focus, using active instead. Am I right in assuming the 'active' link will control the appearance of a link when a visitor is on that particular page? No. Highlighting the current link to show what page you are on at the time (not the one you will go to next) is something different again. See http://www.wickham43.net/highlighthome.php
Create an account or sign in to comment