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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:21:10+00:00 2026-05-26T18:21:10+00:00

I have an CSS issue with a menu. Through CSS I´ve added padding to

  • 0

I have an CSS issue with a menu.

Through CSS I´ve added padding to li‘s.

The li‘s have display: inline.

It works when I set to inline-block, but I want to know why it doesn’t work with inline. In my understanding padding should work with inline elements.

HTML

<header>
<nav>
  <ul id="mainmenu">
    <li><a href="#" class="active">Home</a></li>
    <li><a href="#" class="active">Users</a></li>
    <li><a href="#" class="active">Rankings</a></li>
    <li><a href="#" class="active">In the press</a></li>
    <li><a href="#" class="active">Blog</a></li>
  </ul>
</nav>
</header>

CSS

body { font-family: Arial; font-size: 11px; margin: 0; padding: 0; }
header nav { height: 25px; background: #eeeeee; }
header nav ul { list-style-type: none; margin: 0 auto; padding: 0; width: 960px; }
header nav li { display: inline; padding: 10px 5px; }

Working demo

http://jsfiddle.net/4QLmp/

PS browser is Chrome Canary

  • 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-26T18:21:10+00:00Added an answer on May 26, 2026 at 6:21 pm

    The padding is there, but since the <li>s are defined as inline, they’re aligned to the same text baseline. That cuts off the top padding beyond the top of the page border. If you do change the css to:

    header nav li { display: inline; padding: 20px 5px; border: 1px solid red; position: relative; top: 50px;}

    so that the <ul>s get pushed down, you’ll see the padding present. inline-block doesn’t follow the same text-alignment rules, so everything gets pushed down so the whole block is visible.

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

Sidebar

Related Questions

I have a strange issue with my css navigation menu. The code is here:
I have a web page with a CSS dropdown navigation menu. My issue is
I have a triangle next to menu items, using pure CSS. It works flawlessly
hi I have written css code to display menu bar. faced so many issues
I have css that works on all tr tags for the table. so in
I have some CSS that doesn't behave correctly with IE8. It works fine with
I have a ul/li based side menu, styled with two CSS rules, the following
Gday All, I know this issue is well known, however I have searched high
I have an issue with list-style-image property in CSS with Internet Explorer 8 If
So I'm trying my hands at a css menu and I have a simple

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.