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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:21:24+00:00 2026-05-30T13:21:24+00:00

I have a navigation menu with css. I’m trying to vertically and horizontally center

  • 0

I have a navigation menu with css. I’m trying to vertically and horizontally center the li elements.
I have them centered horizontally, but can’t get them centered vertically… especially since they can be multi-line (ie: Bath&
Kitchen) vs single-line (ie: Plumbing)…

JS Fiddle

CSS:

 #menu { 
    list-style: none; 
    margin: 0; 
    padding: 0; 
    text-align: center;
 }

 #menu li {
      float: left; 
      position: relative; 
      width: 75px; 
      height: 30px; 
      margin-right: 2px; 
      background-color: #994708;
 }

 #menu li a {
      color: #FFFFFF; 
      display: block; 
      position: relative; 
      vertical-align: middle;
      width: 75px; 
      height: 30px; 
      font-size: 11px; 
      line-height: 12px; 
      text-transform: uppercase; 
      text-decoration: none;
 }

HTML:

  <ul id="menu">
      <li><a href="#">All<br />Products</a></li>
      <li><a href="#">New<br />Products</a></li>
      <li><a href="#">Plumbing</a></li>
      <li><a href="#">Bath &<br />Kitchen</a></li>
  </ul>

Any help or thoughts would be appreciated!
Thanks.

  • 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-30T13:21:25+00:00Added an answer on May 30, 2026 at 1:21 pm

    I added a special class to handle the single line menu items. I just wrote some code in the databinding and checked if there was a “line break” in the text. If so, apply the special class.

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

Sidebar

Related Questions

I have a standard ul-based CSS navigation menu. I'm trying to use Jquery to
I'm trying to get a 3rd level of flyout/dropdown on this CSS navigation menu.
I am writing a css code for a webpage, i have a navigation menu
i am styling a navigation menu using the following css. I have found that
I'm trying to create a navigation menu with menu items that don't always have
I'm trying to implement a horizontal multilevel dropdown navigation menu. Immediately below (vertically) the
I have a strange issue with my css navigation menu. The code is here:
I have designed a Navigation Menu, it work fine on Chrome and Firefox but
I have a web page with a CSS dropdown navigation menu. My issue is
I am trying to design a navigation menu that is centered that sits within

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.