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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:36:52+00:00 2026-06-18T05:36:52+00:00

Taken from w3schools (visit link to see what it looks like): <!DOCTYPE html> <html>

  • 0

Taken from w3schools (visit link to see what it looks like):

<!DOCTYPE html>
<html>
  <head>
    <style>
      ul
      {
        float:left;
        width:100%;
        padding:0;
        margin:0;
        list-style-type:none;
      }
      a
      {
        float:left;
        width:6em;
        text-decoration:none;
        color:white;
        background-color:purple;
        padding:0.2em 0.6em;
        border-right:1px solid white;
      }
      a:hover {background-color:#ff3300;}
      li {display:inline;}
    </style>
  </head>

  <body>
    <ul>
      <li><a href="#">Link one</a></li>
      <li><a href="#">Link two</a></li>
      <li><a href="#">Link three</a></li>
      <li><a href="#">Link four</a></li>
    </ul>

    <p>
    In the example above, we let the ul element and the a element float to the left.
    The li elements will be displayed as inline elements (no line break before or after the element). This forces the list to be on one line.
    The ul element has a width of 100% and each hyperlink in the list has a width of 6em (6 times the size of the current font).
    We add some colors and borders to make it more fancy.
    </p>

  </body>
</html>

So, ul and a are float:left;. Now, float says that the next element should float around it, yet the text does not. What am I missing?

Second: Removing the float from the ul makes the text flow around it. What the serious heck?

Third: Removing the inline from li does nothing. Yet, removing the float from a puts whitespace between the elements.

Can anyone even try to explain why these things happen and don’t do what they should?

(Newest Chromium)

  • 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-18T05:36:54+00:00Added an answer on June 18, 2026 at 5:36 am

    The width of the <ul> is 100%. The text has nowhere to go but below it.

    The reason removing float:left from the <ul> will make the text appear to the right is that the <ul> will not be taking up visual space anymore since the contents are all floated inside a non-floated container. It will be 0px tall, and the <p> will STILL drop down below it because of the 100% width, but you won’t notice it visually. You can test this by giving the <ul> a border and see what happens. The <p> will float next to the last floated <li>.

    <li>s are not inline items. display:inline; and display:block are both incorrect. They are display:list-item;

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

Sidebar

Related Questions

Taken directly from W3Schools : Definition and Usage The size attribute specifies the width
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
See the excerpt below taken from a PL/SQL tutorial. The part I have an
Taken from the sample in mongo_dart's blog.dart I'd like to ad some strong typing
Taken from here: http://docs.jboss.org/hibernate/stable/core/reference/en/html/persistent-classes.html#persistent-classes-equalshashcode I tend to use List since Criteria returns List ,
I am trying jQuery for the first time. This code was taken from W3schools.
taken from http://developer.android.com/guide/topics/ui/settings.html : Note: A PreferenceFragment doesn't have a its own Context object.
Taken from http://www.ocf.berkeley.edu/~wwu/riddles/cs.shtml It looks very compiler specific to me. Don't know where to
This program taken from a book Pro JavaScript Techniques is used to create hover-like
Here is a code taken from http://www.angelfire.com/tx4/cus/shapes/haskell98.html . It compiles and executes correctly in

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.