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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:30:22+00:00 2026-06-09T23:30:22+00:00

The code sample below works almost the same, if I include or remove the

  • 0

The code sample below works almost the same, if I include or remove the ‘float: left’ line. The only difference is the float left version moves the blocks below it up a bit more, but not more than a line break. I don’t understand why you would add floating to an element set to 100% width. To my understanding,this prevents everything below it from flowing around it. Isn’t that the purpose of floating?

ul
{
    list-style-type: none;
    float: left;
    width:100%;
    padding:0;
    margin:0;
}

li
{
    display: inline;    
}
  • 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-09T23:30:23+00:00Added an answer on June 9, 2026 at 11:30 pm

    The reason why this works is because your <li> display is set to inline. This means that all elements with of this HTML tag will show up on the same line as all other ones. In other words, there will be no line-break. I would suggest the following instead:

    ul {
        list-style-type: none;
        width: 100%;
        padding: 0px;
        margin: 0px;
        overflow: hidden; /* This will ensure there's a line break after using float for the list items */
    }
    
    li {
        float: left;
    }
    

    This way you can ensure that each list item can also use margin and padding properly as opposed to inline elements which act as characters in a string of text normally would.

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

Sidebar

Related Questions

ummm, probably a simple one... the code below only works with visible (show()) elements
I need to run the code sample below so that it works on a
I have this sample code ( below ), example1() method works with no problem,
I have a sample code snippet below which works just fine (I trimmed the
When sample below code loads in IE9, it works correctly, but when loads in
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I am using Polymorphic Models . Simple Question: My code below works without using
I've put together a small code-sample below (Currently in C# 3.5 but would also
In the sample code below I am dividing by zero which when I step
When I run the sample code below the width of JTextArea is fixed (100px)

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.