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 6601245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:43:41+00:00 2026-05-25T18:43:41+00:00

I am working on a website: http://homegym.sg/index.php/ Have used jquery to create an effect

  • 0

I am working on a website: http://homegym.sg/index.php/

Have used jquery to create an effect such that when the user scroll down, a black menu will appear at the top of the screen. However i have been trying alot of ways but it is not able to show as what i wanted.

I wanted to have the background of the menu fill 100% width of the screen. The middle part of my screen is fixed width (960px) but when the user screen is more than 960px the background will expand to fill the side.

For my website background it is doing that, but for the menu background, the only closest effect i get is having the background fill the entire width of the screen, but with the contents align to the left (what i wanted is center alignment).

My div for the menu is #menu, css are found is menu.css

Here some part of the code:

  #menu {

    width: 100%;
    z-index:888; 
    display:none; 
    position:fixed; 
    top:0 ;
    left: 0;
}

ul.topnav {
    width: 100%;
    list-style: none;
    padding: 0 50px;
    float: left;
    text-align: left;
    background: #222;
    font-size: 1.2em;
    background: url(../images/css_menu/topnav_bg.gif) repeat-x;

}
  • 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-25T18:43:41+00:00Added an answer on May 25, 2026 at 6:43 pm

    The width of the div#menu should be 100% and this div gets the background.
    To center the ul.topnav it needs the real width (of all lis) and margin auto.

    Change your css defintions to:

    #menu {
        background: url("../images/css_menu/topnav_bg.gif") repeat-x scroll 0 0 transparent;
        display: none;
        left: 0;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 888;
    }
    
    ul.topnav {
        font-size: 1.2em;
        height: 35px;
        margin: 0 auto;
        width: 802px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery tooltip available on this website http://flowplayer.org/tools/tooltip and it's working fine
I am working on a website: http://tawfiq-aliyah.co.uk/epic/Site2/ I want the user to be able
Hi Hi have a working website on localhost that I want to move online.
My website ( http://amosjackson.com/index ) has scroll navigation where you click on navigation links
I currently am working a CSS navigation system on my client's website at http://cjcdigital.net/clients/andrea
I upgraded a website I've been working on ( http://barsannapolis.com ) to a CSS
I am currently doing IE-hacks on a website I'm working on: http://www.timkjaerlange.com/wip/co2penhagen/ I got
Working on a website that has Employee and Branch entities, using a database table
Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the
I'm working on a website that will switch to a new style on a

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.