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.



 Subscribe in a reader

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

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Jan 19th, 2008, 17:01
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
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!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 19th, 2008, 17:31
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 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
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 19th, 2008, 19:51
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
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>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 19th, 2008, 19:53
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: How to highlight the current page Nav link ?

You have to do it manually, yes.
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 19th, 2008, 20:30
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jan 19th, 2008, 20:53
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 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>
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jan 19th, 2008, 22:02
Oak's Avatar
Oak Oak is offline
SuperMember

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

hmm.. this produces two link nav tabs?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jan 19th, 2008, 22:30
Most Reputable Member
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).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jan 20th, 2008, 00:05
Up'n'Coming Member
Join Date: Jan 2008
Location: London
Age: 18
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Jan 20th, 2008, 12:33
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Jan 20th, 2008, 12:37
Up'n'Coming Member
Join Date: Jan 2008
Location: London
Age: 18
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Jan 20th, 2008, 13:21
Oak's Avatar
Oak Oak is offline
SuperMember

SuperMember
Join Date: Dec 2007
Location: London
Age: 35
Posts: 304
Thanks: 6
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
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 10:10.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization 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