How to highlight the current page Nav link ?

This is a discussion on "How to highlight the current page Nav link ?" within the Web Page Design section. This forum, and the thread "How to highlight the current page Nav link ? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 19th, 2008, 17:01
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
How to highlight the current page Nav link ?

I want the the Nav link of the page that is showing to be defined.

Please provide link, proper search term to tutorial or code

Thanks again!!
Reply With Quote

  #2 (permalink)  
Old Jan 19th, 2008, 17:31
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: How to highlight the current page Nav link ?

Ok. You need to give the link which is active an id. Presuming you have used an unordered list, it would be:
Code: Select all
<ul>
<li><a href="#">Link</a>
<li id="active"><a href="#">Link</a>
</ul>
And then the CSS
Code: Select all
li #active {
...
}
HTH. Jack
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #3 (permalink)  
Old Jan 19th, 2008, 19:51
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

so when someone is on a page of me website the page link will indicate that it is active, yes.

Do I have to add the id
<li id="active"><a href="#">mywebpage</a>

to each link?


<ul>
<li><a href="/">Welcome</a></li>
<li><a href="#" rel="dropmenu1">Classes</a></li>
<li><a href="capoeira-school-contact.php">Contact</a></li>
<li><a href="capoeira-school-images.php">Images</a></li>
<li><a href="capoeira-school-links.php">Links</a></li>
<li><a href="capoeira-events-up-coming.php">Events</a></li>
<li><a href="#" rel="dropmenu2">Capoeira FAQs</a></li>
<li class="end"><a href="capoeira-school-risadinha.php">The Teacher</a></li>
</ul>
Reply With Quote
  #4 (permalink)  
Old Jan 19th, 2008, 19:53
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: How to highlight the current page Nav link ?

You have to do it manually, yes.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jan 19th, 2008, 20:30
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

The nav bar is not liking this.

example

<ul>
<li><a href="capoeira-school-links.php">Links</a></li>
<li id="active"><a href="#">Link</a>
</ul>

so I tried this !?

<li id="active"><a href="capoeira-school-links.php">Links</a></li>

This seems to do the job, though the back ground colour that I chose does not fill the nav tab.

Last edited by Oak; Jan 19th, 2008 at 20:36.
Reply With Quote
  #6 (permalink)  
Old Jan 19th, 2008, 20:53
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: How to highlight the current page Nav link ?

You say that this code is not working?
Code: Select all
<ul>
<li><a href="capoeira-school-links.php">Links</a></li>
<li id="active"><a href="#">Link</a>
</ul>
You've missed out a </li>!

Code: Select all
<ul>
<li><a href="capoeira-school-links.php">Links</a></li>
<li id="active"><a href="#">Link</a></li>
</ul>
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #7 (permalink)  
Old Jan 19th, 2008, 22:02
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

hmm.. this produces two link nav tabs?
Reply With Quote
  #8 (permalink)  
Old Jan 19th, 2008, 22:30
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

Quote:
Originally Posted by jackfranklin View Post
You have to do it manually, yes.
Not necessarily.

You can use PHP or javascript to match the link HREF with the page URL, and apply a class (or remove the link entirely).
Reply With Quote
  #9 (permalink)  
Old Jan 20th, 2008, 00:05
Up'n'Coming Member
Join Date: Jan 2008
Location: London
Age: 17
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

Quote:
hmm.. this produces two link nav tabs?
Yes, that code creates two nav tabs as it has two <li>'s
PHP: Select all

<ul>
<
li><a href="capoeira-school-links.php">Links</a></li>
<
li id="active"><a href="#">Link</a></li>
</
ul
You can make a simple PHP script to detect which link is active and make the id="active"

For the colour not taking up the whole space, screenshot please?

~Dean
Reply With Quote
  #10 (permalink)  
Old Jan 20th, 2008, 12:33
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

Quote:
You can make a simple PHP script to detect which link is active and make the id="active"
You might be able to make a simple PHP script by I am not! link to tutorial?

Quote:
For the colour not taking up the whole space, screenshot please?
I don't think this code will work the color still appears when the page isn't active.

I would like to know how take a screen shot!

Cheers
Reply With Quote
  #11 (permalink)  
Old Jan 20th, 2008, 12:37
Up'n'Coming Member
Join Date: Jan 2008
Location: London
Age: 17
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

Quote:
I would like to know how take a screen shot!
Are you serious? :O

Ok, theres a Print Screen button on your keyboard, find it, push it.

Then open an image program (Paint usualy)
Push Ctrl+V (Paste) and your screenshot will appear.

Save it, then upload it to a free image host (www.imageshack.us ) or google one.

As for a Tut, im not sure..someone else will have to help you on that bit.

~Dean
Reply With Quote
  #12 (permalink)  
Old Jan 20th, 2008, 13:21
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 268
Thanks: 2
Thanked 0 Times in 0 Posts
Re: How to highlight the current page Nav link ?

Ok, ok!

should be a screen shot attached

but as I said not sure about the code.
Attached Images
File Type: jpg scrshot.jpg (22.4 KB, 11 views)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Current page problems unitedcraig Web Page Design 3 Jun 10th, 2008 20:44
After login: Redirect to page in history (Current - 2)... skuliaxe PHP Forum 4 Feb 20th, 2008 16:54
highlight current page unitedcraig Web Page Design 53 Feb 13th, 2008 22:20
highlight the current page of a drop down menu Oak Web Page Design 2 Feb 12th, 2008 03:08
Indicating current page on navigation bar masonbarge PHP Forum 2 Oct 30th, 2006 19:40


All times are GMT. The time now is 16:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43