Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:54:07+00:00 2026-05-31T02:54:07+00:00

I have a navigation bar which i am using css to highlight on hover

  • 0

I have a navigation bar which i am using css to highlight on hover and when the li has class active. I would like to has a transition to fade the background in. This is what I have so far:

CSS:

#nav {height:32px; border-top: 1px solid #fff; border-right: 1px solid #FFFFFF; background: #141941 url('../img/topTierBG.gif') repeat-x; }
#nav ul {padding: 0px; list-style: none; height:32px; width:100%;  }
#nav li { position:relative; float: left; margin:0; border-left:1px solid #fff; line-height:30px; background: #141941 url('../img/topTierBG.gif') repeat-x; padding-top:0px;}
#nav a, #nav a:link, #nav a:visited, #nav a:hover, #nav a:active {width:156px; display:block; text-align:center; font-size:12px; text-decoration:none; color:#fff; margin: 0px 0px 0px 0px; -webkit-transition: background 0.5s linear; -moz-transition: background 0.5s linear; -o-transition: background 0.5s linear; transition: background 0.5s linear; }
#nav .active {text-align:center; text-decoration:none; padding:0; color:#fff; height:32px; background: #1D2248 url('../img/activeTab.gif') repeat-x; }
#nav a:hover, #nav a:active{background: #1D2248 url('../img/activeTab.gif') repeat-x; -webkit-transition: background 0.5s linear; -moz-transition: background 0.5s linear; -o-transition: background 0.5s linear; transition: background 0.5s linear; }

html:

<div id="nav"><ul id="xmp-nav">
<li class="active"><a href="/" style="width:196px;">HOME</a></li>
<li><a href="login.php" style="width:195px;">STAFF LOGIN</a></li>
<li><a href="resources.php" style="width:195px;">RESOURCES</a></li>
<li><a href="information.php" style="width:195px;">PARENT INFORMATION</a></li>
<li><a href="links.php" class="last" style="width:195px;">LINKS</a></li>
</ul></div>

Problem is that when i hover over a non-active tab the transition doesn’t happen but when i hover over the already active tab is transitions from the non-active style to the active style.

I look forward to hearing your ideas, if it is not possible with the way i have laid it out no problem.

Here is a link!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:54:09+00:00Added an answer on May 31, 2026 at 2:54 am

    Transitions works this way:

    1. You have element with state A (for example li).
    2. You change elements state to B (for example by adding new class to li or adding :hover to it) which changing it’s properties (for example background: red).
    3. In the new class/state you are adding transition, and set which property to animate (for example background).

    And now you can see smooth animation.

    In your example you have two transitions:

    1. “transition: background 0.5s linear;” on #nav a — it didn’t work because there is no background change in #nav a on hover.
    2. transition: background 0.5s linear; on #nav a:hover, #nav a:active — it means change background of “#nav a” from “none”, to “background: #1D2248 url(‘../img/activeTab.gif’) repeat-x;” with linear animation in 0.5s.

    I made simplified jsfiddle from you code that shows how to change animations on hover:

    http://jsfiddle.net/hzTwz/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a navigationController which has a navigation bar. I would really like to
I have an app, which has a top navigation bar and a bottom tab
I have a navigation bar/list that is using only HTML and CSS. The background
I have a navigation bar that has two dropdowns (as nested ul's). I'm trying
I have a UIBarButtonItem on a navigation bar. I'd like to make it arrow
I have my navigation bar using unordered links and using jquery for ui effects.
I have a navigation bar which is dynamically populated with LinkButtons by an ASP
I'm using the navigation controller project. I'd like to have a main menu without
I have a navigation bar which consists of a <img> elements within their respective
I'm trying to build a very simple pure css navigation bar, but have hit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.