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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:23:04+00:00 2026-05-26T01:23:04+00:00

When writing CSS, I always find myself missing auto child width feature of floated

  • 0

When writing CSS, I always find myself missing auto child width feature of floated child elements, to fit their total width to the parent’s width.
In fact I find it hard to phrase in Google search box, so you may consider this example:
A ul contains four li
li has float: left; list-style: none; and because there are four li elements, each has width: 25%;
What if I want to make the number of li elements variable, instead of fixed four, so li gets width of 20% when they are five, or gets width of 10% if they are ten, or width of 50% when they are two etc..? Given that the ul has an explicit fixed width always.

  • 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-26T01:23:04+00:00Added an answer on May 26, 2026 at 1:23 am

    You might be able to use css3’s flex-box.

    ul{display:box;}
    li{box-flex:1;}
    

    Here’s a jsfiddle to demonstrate(you may need to change -webkit to -moz or -o) http://jsfiddle.net/wKKte/

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

Sidebar

Related Questions

I'm writing a jquery-plugin, that changes a css-value of certain elements on certain user-actions.
I am writing a css code for a webpage, i have a navigation menu
I'm writing a webmail product and some emails have body css that changes the
I am writing a class that inherits from IHttpHandler for script and css combining.
I am writing a class that inherits from IHttpHandler for script and css combining.
While writing code in a file that would comprise of PHP, HTML, CSS &
I am writing an web application powered by PHP, Smarty, JavaScript, CSS, MySQL. There
Has anyone had any experience writing a web control (in either ASP.net, or javascript/HTML/CSS),
One of my biggest trouble with CSS has always been how tricky it is
When I first started writing CSS, I was writing it in an expanded form

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.