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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:52:16+00:00 2026-05-30T18:52:16+00:00

I’m trying to make an horizontal menu, vertically and horizontally aligned. I’m actually using

  • 0

I’m trying to make an horizontal menu, vertically and horizontally aligned.

I’m actually using

    tags, and it looks exactly as I want in firefox.
    However, this is the only browser where it is rendered correctly.

    • In internet explorer 9, the background that appears when I mouse over on an item, is moved 1 px upper, over the black line.
    • In chrome, the li element is 20px high instead of 16 like on firefox, moving the menu a little lower
    • In safari and opera I have the same chrome problem.

    Notice that opera, safari and chrome also have a problem where my separator is 3px high and 1px large, while on firefox I can visualize it correctly.

    I don’t know really why, but because I lost 2 nights behind this problem I think I need definitely some help.

    Here is the situation with firefox (you can click on images to zoom in):

    Firefox situation

    While here you can see Chrome situation (webkit in general):

    Webkit situation

    The css for the menu is this:

    #menu
    {
      bottom: 111px;
      height:  54px;
      width:   100%;
      top:     auto;
    }
    
    #menu-bar-top, #menu nav
    {
      background-repeat: repeat-x;
      width:              inherit;
    }
    
    #menu-bar-top
    {
      background-image:  url(../../img/Layouts/default/Hr-bottom.png);
      background-color:                                   transparent;
      border-style:                                              none;
      height:                                                    18px;
    }
    
    #menu nav
    {
      background-image:  url(../../img/Layouts/default/Menu-background.png);
      height:                                                          36px;
    
    }
    
    #menu nav div
    {
      text-align:  center;
      height:     inherit;
      margin:           0;
    }
    
    #menu nav ul
    {
      list-style-type:         none;
      font-family:     Ethnocentric;
      font-size:              1.2em;
      padding:                    0;
      height:               inherit;
      margin:                     0;
      color:                  white;
    }
    
    #menu nav ul li
    {
      position: relative;
      top: 10px;
      display:     inline;
      padding:          0;
      margin:           0;
    }
    
    #menu nav ul li.menu-separator
    {
      background-position:                                     center center;
      background-repeat:                                           no-repeat;
      background-image:    url(../../img/Layouts/default/Menu-separator.png);
      font-size:                                                         1px;
    }
    
    #menu nav ul li a
    {
      text-decoration:  none;
      padding:          10px 10px 8px 10px;
      margin:         0 -5px;
      color:           white;
    }
    
    #menu nav ul li a:hover
    {
      background-position:                                                  0px 0px;
      background-repeat:                                                   repeat-x;
      background-image:    url(../../img/Layouts/default/Menu-background-hover-2.png);
    }
    

    While html can be found here:

    <section id="menu">
        <hr id="menu-bar-top" />
        <nav>
            <div>
                <ul>
                    <li><a href="#">Home</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Lavori svolti</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Balbo e consorzi</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Ciao</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Etc...</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Etc...</a></li>
                    <li class="menu-separator">&nbsp;</li>
                    <li><a href="#">Etc...</a></li>
                    <!-- ... other Etcs ...-->
                </ul>
            </div>
        </nav>
    </section>
    

    Because I think ul is creating me more problems than it should, I’m ok with changing html markup (notice that is html5), doesn’t matter if it feels a bit incorrect (like using divs and spans only). What I really need, is a crossbrowser solution to this and any suggestion is appreciated. I don’t need Ie6 support, I’m ok with IE9 and lasterversion of chrome, opera, safari, firefox.

    Notice that the background of my menu and the background of the mouseover effect are both gradients, so I can’t just use a color.

    Thanks for any suggestion, hope anyone can help me with this because I can’t really solve the problem and I would like to avoid various css per browser.

    Edit 1:
    I don’t get why I can’t make the separator height what I want, I put text inside but definitely doesn’t fit the size I need, it’s an inline element but I can’t put a block element inside an inline element :\

    Edit 2:
    Ok I have uploaded the whole webpage with graphics, I didn’t create a JSFiddle at the moment but you can see the webpage and download it as a ZIP file:

  • View the webpage
  • Download the webpage (if you don’t trust me simply download the otherone from the browser)
  • JSFiddle

Edit 3:
Added the JS Fiddle, however I can’t make font works there

  • 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-30T18:52:17+00:00Added an answer on May 30, 2026 at 6:52 pm

    While Jona’s answer helped me a lot with pseudo-elements (I didn’t know it was possible such a thing), it doesn’t answer completely to my question: expecially, I used a line-height that is half of my height and I didn’t use float: left, which instead creates only problems with centering the menu.

    Instead what really fixed everything for me is display:block on A tag and expecially display: inline-block for li tags.

    This changed the way tags behaves to do exactly what I wanted with some minor tweaks.

    I still have some small problems with google chrome, but I think is connected with the fact that for chrome (and safari) the font is 20 px height instead of 16 like in all other browsers (don’t know why), but they are not so bad (the text is 4 px lowered, I can accept this).

    Here is the complete edit of what I built with css, using Diodeus’s and Jona’s answers, along with a small html markup change:

    HTML:

      <section id="menu">
        <hr id="menu-bar-top" />
        <nav>
          <div>
            <ul>
              <li><a href="#">Home</a></li>
              <li><a href="#">Lavori svolti</a></li>
              <li><a href="#">Balbo e consorzi</a></li>
              <li><a href="#">Ciao</a></li>
              <li><a href="#">Etc...</a></li>
              <li><a href="#">Etc...</a></li>
            </ul>
          </div>
        </nav>
      </section>
    

    CSS:

    /**
     *     Creates a font that should be used in all pages TEST
     */
    
    @font-face
    {
      font-family:                                                          Ethnocentric;
      src:                                              url('../files/ethnocentric.eot');
      src:         url('../../files/ethnocentric.eot?iefix') format('embedded-opentype'),
                                     url('../../files/ethnocentric.woff') format('woff'),
                                  url('../../files/ethnocentric.ttf') format('truetype'),
                                       url('../../files/ethnocentric.svg') format('svg');
    }
    
    *
    {
      padding: 0;
      margin:  0;
    }
    
    html, body
    {
      max-height:               100%;
      overflow:               hidden;
      height:                   100%;
    }
    
    /**
     *     Change the basic background color of the page
     */
    html
    {
      background-image: url(../../img/Layouts/default/Background.png);
      font-family:                                  Arial, sans-serif;
      font-size:                                                 10px;
    }
    
    /**
     *     Helper to clear from float
     */
    .clear
    {
      clear: both;
    }
    
    input[type="radio"].radio-hidden
    {
      position: absolute;
      display:      none;
      left:      -9999px;
      top:       -9999px;
    }
    
    header, #menu, footer
    {
      background-repeat: repeat-x;
      position:          absolute;
      overflow:            hidden;
      bottom:                   0;
      width:                 100%;
      right:                    0;
      left:                     0;
      top:                      0;
    }
    header
    {
      background-image: url(../../img/Layouts/default/Gradient-top.png);
      height:                                                     125px;
    }
    
    #content
    {
      /*background-repeat:                                             repeat-y;
      background-image:  url(../../img/Layouts/default/Background-center.png);*/
      position:                                                         fixed;
      overflow:                                                          auto;
      margin:                                                   0 auto 0 auto;
      bottom:                                                           165px;
      /*width:                                                            789px;*/
      width: 77%;
      right:                                                                0;
      left:                                                                 0;
      top:                                                              112px;
    
      border-width: 2px;
      border-style: solid;
      border-color: black;
      border-top-width: 0;
      border-bottom-width: 0;
      background-color: #5E656A;
    }
    
    #menu
    {
      bottom: 111px;
      height:  54px;
      width:   100%;
      top:     auto;
    }
    
    footer
    {
      background-image: url(../../img/Layouts/default/Gradient-bottom.png);
      height:                                                        111px;
      top:                                                            auto;
    }
    
    header div
    {
      margin-right:  auto;
      margin-left:   auto;
      padding-top:   16px;
      width:        788px;
    }
    
    #menu-bar-top, #menu nav
    {
      background-repeat: repeat-x;
      width:              inherit;
    }
    
    #menu-bar-top
    {
      background-image:  url(../../img/Layouts/default/Hr-bottom.png);
      background-color:                                   transparent;
      border-style:                                              none;
      height:                                                    18px;
    }
    
    #menu nav
    {
      background-image:  url(../../img/Layouts/default/Menu-background.png);
      height:                                                          36px;
    
    }
    
    #menu nav div
    {
      text-align:  center;
      height:     inherit;
      margin:           0;
    }
    
    #menu nav ul
    {
      list-style-type:         none;
      font-family:     Ethnocentric;
      font-size:              1.2em;
      padding:                    0;
      height:               inherit;
      margin:                     0;
      color:                  white;
    }
    
    #menu nav ul li
    {
      position:     relative;
      display:  inline-block;
      padding:             0;
      height:        inherit;
      margin:              0;
      top:               0px;
    }
    
    #menu nav ul li a
    {
      text-decoration:         none;
      line-height:             15px;
      display:                block;
      padding:                 10px;
      margin:          0 -2px 0 1px;
      color:                  white;
    }
    
    #menu nav ul li a:hover, #menu nav ul li a:focus
    {
      background-position:                                                    0px 0px;
      background-repeat:                                                     repeat-x;
      background-image:    url(../../img/Layouts/default/Menu-background-hover-2.png);
    }
    
    #menu nav ul li a:before
    {
      background-image: url(../../img/Layouts/default/Menu-separator.png);
      position:                                                  absolute;
      content:                                                         "";
      bottom:                                                       33.3%;
      width:                                                          2px;
      left:                                                          -2px; /* negative width of the seperator */
      top:                                                          33.3%;
    }
    
    #menu nav ul li a.menu-first:before
    {
      background: none;
      width:         0;
      left:          0;
    }
    
    /* reset the firsit item */
    #menu nav ul li:first-child a
    {
        margin-left: -1px;
    }
    
    #menu nav ul li:first-child a:before
    {
        display: none;
    }
    
    #company-info, #webdesigner-info
    {
      font-size:    0.9em;
      position:  absolute;
      color:      #8E8C8C;
    }
    
    #company-info
    {
      margin-left: 16px;
      margin-top:  11px;
      left:           0;
      top:            0;
    }
    
    #webdesigner-info
    {
      margin-bottom: 11px;
      margin-right:  16px;
      bottom:           0;
      right:            0;
    }
    

    You can visit the webpage here (this link won’t last ever)

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

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.