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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:38:13+00:00 2026-06-17T16:38:13+00:00

In one post I read there was a question about floated <li> in <ul>

  • 0

In one post I read there was a question about floated <li> in <ul>. The guy was asking why his <ul> background disappears when he floated the <li>‘s and how he could fix this. An answer was to set overflow:hidden to the <ul>. I tried it, and it will worked, but I haven’t read and heard before something like that.

My question is: Can you use overflow:hidden for clearing elements like clearfix?

In this case:

<ul>
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>

if I have the following CSS:

ul{
  background: #999;
  overflow: hidden;
}

li {
  float: left;
}

Do I still need to clear with: <ul class="clearfix"> and CSS:

.clearfix { *zoom: 1; }
.clearfix:after { 
    width: 100%; 
    content: ''; 
    font-size: 0; 
    line-height: 0; 
    text-indent: -4000px; 
    clear: both; 
    display:block; 
}

Or I just can let overflow:hidden to do that job

  • 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-17T16:38:14+00:00Added an answer on June 17, 2026 at 4:38 pm

    Yes!

    There are three ways to clear:

    1. Using overflow: hidden; to the parent of the floated elements.
    2. Giving a float: left; or float: right; to the parent of the floated elements.
    3. Giving a clearing element as a sibling at the end of the floated elements.

    For your question…

    Yes, you can just use the overflow: hidden; to do, but there’s a problem. Say you have something like flyout list or popover, those things get cut with the dimensions of the UL tag.

    If you want them to be displayed too, you need to use <ul class="clearfix">. I would say, clearfix is better than overflow: hidden;.

    ps: I am a front end engineer developing enterprise web applications that compatible across all browsers.

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

Sidebar

Related Questions

I've read the blog post at letitcrash.com about Play-mini and Akka ( this one
So I've already read this post about there not being an MGET analog for
Sorry for the two fold question in one post. This indirectly relates to a
Thanks for taking the time to read this post. Hope those who are asking
I recently read the following overflow post: Hidden Features of C# One of the
I read with interest the post How universally is C99 supported ?. One of
This is my code that works perfectly to post one object to my server.
One possible solution could be simple HTTP get or post request, but that wouldn't
So I saw this post here and read it and it seems like bulk
I have read some post about fetch=join - http://nhforge.org/blogs/nhibernate/archive/2009/04/09/nhibernate-mapping-lt-many-to-one-gt.aspx (ser4ik.livejournal.com/2505.html) So I have some

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.