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

  • Home
  • SEARCH
  • 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 7715181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:19:14+00:00 2026-06-01T02:19:14+00:00

i have been working on this sub-menu for 8 hours now, the last little

  • 0

i have been working on this sub-menu for 8 hours now, the last little thing i cant figure out is how to do is to center the li items (or the ul item) in the sub-menu. Maby this picture helps:enter image description here

I need to center all the li items under the blue arrow. This is my code for the ul ul and ul ul li. Please leave a comment if you need more information, all tips hints and ofc. answers are appreciated 🙂

 /*
 *
 * Menu
 *
 */
#access {
    display: block;
    width: 46.4em;
    float: right;
    height: 7.3em;
    line-height: 7.3em;
    margin: 0 1.5em 0 0;
}
#access ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
    text-align: center;
}
#access li {
    float: left;
    padding: 0 2em;
}
#access a {
    position: relative;
    height: 73px;
    font-size: 1.4em;
    display: block;
    line-height: 5.071428571em;
    font-family: Georgia, Times New Roman, serif;
    text-transform: uppercase;
    color: #009cda;
}
.current-menu-item {
    background: url("images/arrow.png") no-repeat;
    background-position: 50% 100%;
}
.current-cat-menu-item  a {
    text-decoration: underline;
}
ul li .current-menu-item{
    background: none;
}
.current-menu-item.parent-item  a:hover {
    background: url("images/arrow-blue.png") no-repeat;
    background-position: 50% 229%;
}
#access ul ul {
    display: none;
    top: 100%;
    z-index: 998;
    position: absolute;
    height: 36px;
    text-align: center;
}
#access ul ul li{
    display: inline;
    list-style: none;
}
#access ul ul a {
    color: #fff;
    font-size: 12px;
    line-height: 3em;
    height: auto;
    z-index: 1000;
    text-transform: none;
    font-family: Arial, sans-serif;
}
#access li:hover > a,
#access ul ul :hover > a {
    text-decoration: underline;
}
#access .parent-item:hover > a  {
    background: url("images/arrow-blue.png") no-repeat;
    background-position: 50% 229%;
    z-index: 999;
}
#access ul ul :hover > a {
        background: none;
}
#access ul li:hover > ul {
    display: block;
}
.sub-menu-wrapper {
    display: none;
    width: 100%;
    height: 36px;
    top: 71px;
    left: 0;
    position: absolute;
    background: url("images/blue.png") repeat-x bottom;
    z-index: 997;
    /* #009CDA;
    -webkit-box-shadow: inset 0px -1px 5px 0px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: inset 0px -1px 5px 0px rgba(0, 0, 0, 0.3);
    box-shadow: inset 0px -1px 5px 0px rgba(0, 0, 0, 0.3);  */
}
#access ul li:hover > span {
    display: block;
}

This is my html structure:

<nav class="menu-topp-meny-container">
    <ul id="menu-topp-meny" class="menu">
        <li id="menu-item-116" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-116">
            <a href="http://test3.clydemarketing.com/om-monster-2/">Om Monster</a>
        </li>
        <li id="menu-item-225" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-171 current_page_item current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor menu-item-225 parent-item">
            <a href="http://test3.clydemarketing.com/entertainment/om-oss/">Avdelinger</a>
            <ul class="sub-menu">
                <li id="menu-item-254" class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-page-parent menu-item-254">
                    <a href="http://test3.clydemarketing.com/entertainment/">Entertainment</a>
                </li>
                <li id="menu-item-260" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-260">
                    <a href="http://test3.clydemarketing.com/entertainment/kontakt/">Kontakt</a>
                </li>
                <li id="menu-item-261" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-261">
                    <a href="http://test3.clydemarketing.com/entertainment/arkiv/">Arkiv</a>
                </li>
                <li id="menu-item-262" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-171 current_page_item menu-item-262">
                    <a href="http://test3.clydemarketing.com/entertainment/om-oss/">Om Oss</a>
                </li>
            </ul>
        <span class="sub-menu-wrapper"></span>
        </li>
        <li id="menu-item-26" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-26">
            <a href="http://test3.clydemarketing.com/kontakt/">Kontakt</a>
        </li>
        <li id="menu-item-25" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-25">
            <a href="http://test3.clydemarketing.com/jobb/">Jobb</a>
        </li>
    </ul>
</nav>
  • 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-01T02:19:16+00:00Added an answer on June 1, 2026 at 2:19 am

    Calculate the total width of all li items you have and add this to your ul‘s css:

    var total = 0;
    $('li').each(function(){
        total += $(this).width();
    });
    $('ul').css({
        'width': total + 'px',
        'margin': '0px auto'
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on this for 24 hours now, trying to optimize it.
Have been working on this question for a couple hours and have come close
I have been working on this for few hours and got stuck, so how
I have been working on this problem for 2 days now and it's an
I have been working on this problem for a while now. I am trying
I'm close to nailing this flyout menu I have been working on, just have
I've been working on this for several hours now, I'm terrible with databinding, and
I have been working very hard on figuring this out and just can't understand
I have been working on this app for at least 3-4 months and just
I have been working on this sort of ATM (With a maximum of 50

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.