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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:01:17+00:00 2026-06-17T22:01:17+00:00

Including the float: left at the place labeled here!!! made the padding of the

  • 0

Including the “float: left” at the place labeled “here!!!” made the padding of the “a” element independent of the padding of the ancestor “ul” element. Also the space between the “a” elements disappeared, as shown in picture A (before including “float: left”) and picture B (after).

enter image description here

enter image description here

Could someone explain why this happens for me?

#top-menu {
    width: 470px;
    height: 200px;
    position: absolute;
    right: 0;
    border: solid;
}

#top-menu ul {
    width: 400px;
    float: left;
    padding: 20px;
    position: absolute;
    right: 0;
    bottom: 0;
    border: solid;
}

#top-menu li {
    display: inline;
    position: relative;
}

#top-menu li a {
    border: 1px solid transparent;
    border-radius: 4px 4px 4px 4px;
    color: #5A6770;
    float: left; /* <----- HERE!!! -----*/
    padding: 15px 20px;
    position: relative;
    text-decoration: none;
}

#top-menu li a:hover {
    background-color: #ECEFF2;
    border-color: #D1D6D9;
}

#top-menu li a:active {
    background-color: #E4E7EB;
    border-color: #BAC1C6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18) inset;
}
  • 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-17T22:01:18+00:00Added an answer on June 17, 2026 at 10:01 pm

    That’s because the <a> element is inline element. And when you add it float:left it starts acting like block element.

    You can only have margin and padding on inline elements which affects only the “line” .. i.e left and right. But you can’t top and bottom because for example. Imagine that you have long paragraph, about 10 lines. And somewhere you have span or a – inline elements. There is no logic to give them top and bottom margin and padding, cause the all paragraph will brake, but you can add left and right.

    Very good explanation you can find HERE.

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

Sidebar

Related Questions

I have a sidebar #sidebar { float: left; position: relative; width: 200px; padding: 20px;
Including DISTINCT to an SQL query that also uses ORDER BY CAST(thecolumn AS int)
I styled an image with float:left, and predictably, the text of the header after
Here's the idea: I have a div element, #content_wrapper, which encompasses three floated divs,
I am looking for a way to convert datetime objects to decimal(/float) year, including
I have tried many ways, including the following: <table style=border-collapse: collapse; width: auto; float:
I've read a lot about float representation recently (including this: How To Represent 0.1
I have this HTML: <td> <ol start=4> <li> <div style=float:left;>some text</div> <div style=float:right;> <img
How positioning can save our time if we use in place of float on
I have a header box including border and padding and background color for that

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.