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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:23:48+00:00 2026-06-17T10:23:48+00:00

I have this menu fixed, how can I center this menu? I already tried

  • 0

I have this menu fixed, how can I center this menu?
I already tried with margin: 0 auto, and float: left, but it doesn’t work.
Are there any way to center ??
here I have a demo:

http://jsbin.com/enaliw/3/edit

<nav>
        <ul id="main-nav" class="clearfix">
            <li><a href="#;">Inicio</a></li>
            <li><a href="#">Guia</a></li>
            <li><a href="#">Heroes</a></li>
            <li><a href="#">Videos</a></li>
            <li><a href="#">ScreamShots</a></li>
        </ul>
    </nav>

CSS

#main-nav {

width: 100%;
margin: 0 auto;
padding: 0;
position: fixed;
left: 0;
/*bottom: 0;*/
z-index: 100;
background: #9dd53a; /* Old browsers */
background: -moz-linear-gradient(top, #9dd53a 26%, #a1d54f 47%, #80c217 67%, #7cbc0a 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(26%,#9dd53a), color-stop(47%,#a1d54f), color-stop(67%,#80c217), color-stop(100%,#7cbc0a)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #9dd53a 26%,#a1d54f 47%,#80c217 67%,#7cbc0a 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #9dd53a 26%,#a1d54f 47%,#80c217 67%,#7cbc0a 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #9dd53a 26%,#a1d54f 47%,#80c217 67%,#7cbc0a 100%); /* IE10+ */
background: linear-gradient(to bottom, #9dd53a 26%,#a1d54f 47%,#80c217 67%,#7cbc0a 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9dd53a', endColorstr='#7cbc0a',GradientType=0 ); /* IE6-9 */
border-radius: 8px;}

#main-nav li {
position: relative;
margin: 0 auto;
padding: 0;
list-style: none;
float: left;}


#main-nav a {
margin: 0 auto;
line-height: 100%;
font-weight: bolder;
color: #000000;
display: block;
padding: 15px 20px;
text-decoration: none;}
  • 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-06-17T10:23:49+00:00Added an answer on June 17, 2026 at 10:23 am

    You can change the #mainnav li as from float: left; to display: inline-block;

    #main-nav li {
        position: relative;
        margin: 0 auto;
        padding: 0;
        list-style: none;
        display: inline-block;
    }
    

    and then you can use text-align: center; on the ul.

    #main-nav {
    ...
         text-align: center;
    ...
    }
    

    Working Demo:
    http://jsfiddle.net/rSc9s/

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

Sidebar

Related Questions

I have this menu structure: http://jsfiddle.net/Rochefort/szL2C/ everything is ok. But i want, hover effect
I'm using NUnit (but have also tried this with VS testing) and I'm having
OK so I'm trying to make a top fixed menu and I have this
I have this menu: <h:selectOneMenu value=#{ApplicationController.settings['SessionTTL']}> <f:selectItem itemValue=60 itemLabel=1 hour /> <f:selectItem itemValue=30 itemLabel=30
I have this menu structure that is used to navigate through content slider panels.
I have a simple dropdown menu and I'd like to have this menu close/hide
I have this ul menu: <ul id=superfish-1> <li class=active-trail><a href=# class=sf-depth-1 active>Inicio</a></li> <li class=trail><a
i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
I have this typoscript language menu: tmpl.NavLang = HMENU tmpl.NavLang { special=language special.value =
I have this script that run to fix my menu bar to the browser

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.