Solved

Highlight Current Page's Tab

Posted on 2009-04-07
8
1,155 Views
Last Modified: 2012-05-06
Hi experts,

I am developing a project in ASP.NET using Visual Web Developer 2008 Express Edition. I have a tab menu which works perfect. I would like for a tab to stay orange while on the page that the tab links to. For example, when on Default.aspx, I would like Home tab to be highlighted. Is there any way to do that? I am using Master page. It would be easy if I didn't.

Please use IE to look at this page. It doesn't display quite right in FF.

http://www.titanmusicstore.com

Thank you.
0
Comment
Question by:RealSnaD
  • 4
  • 2
  • 2
8 Comments
 
LVL 4

Accepted Solution

by:
iDeej earned 500 total points
Comment Utility
in the home page you could give the body tag an id="home" and then give all your tabs id's as well E.G. id="tabHome"

The write this CSS

#home #tabhome {
  background: /*set to orange background*/;
}

because the home page is the only page that has id = home in the body tag it is the only page that this style will effect.

You can then go and do it with all other pages <body id="catalog"> for the catalog page etc.

0
 
LVL 9

Expert Comment

by:Ramanhp
Comment Utility
<style>
span.col2 {
        margin-left: 10em;
 width:100px;
}
 
span.col3 {
        margin-left: 10em; width:100px;
 
}
 
span.col4 {
        margin-left: 10em; width:100px;
 
}
 
 
div.row {
overflow: auto;
font-weight: bold;
width: 100%;
float: left;
padding-top: 5px;
padding-left: 0px;
padding-bottom: 5px;
padding-right: 0px
}
</style>
 
<div class="row">                      
Item One                        
<span class="col2">
Item Two
</span>
<span class="col3">
Item Three
</span>
<span class="col4">                            
Item Four
</span>
</div>
                       
<div class="row">
Item Five                      
<span class="col2">                    
Item Six                                                
</span>
<span class="col3">
Item Seven
</span>
<span  class="col4">                    
Item Eight
</span>
</div>
0
 
LVL 9

Expert Comment

by:Ramanhp
Comment Utility
oh sorry, please ignore my reply, got pasted in the wrong window

Thanks
0
 
LVL 7

Author Comment

by:RealSnaD
Comment Utility
Thank you! But I have a master page. I don't have body tags on each page. Just on the master page.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 4

Expert Comment

by:iDeej
Comment Utility
I've not used ASP but is there a way you can dynamically set an id to a containing element or set class="tabOn" in a li of you navigation?
0
 
LVL 7

Author Comment

by:RealSnaD
Comment Utility
This is my first website in ASP .NET. I don't know :) I'll continue researching.
0
 
LVL 7

Author Comment

by:RealSnaD
Comment Utility
iDeej, thanks man! I figured out how to assign id's dynamically and used CSS that you provided. It works. Check it out :)
0
 
LVL 7

Author Closing Comment

by:RealSnaD
Comment Utility
Great solution!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now