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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:57:19+00:00 2026-06-13T04:57:19+00:00

Why is following CSS-Code not filling up 100% of the screen? I’ve 5 columns

  • 0

Why is following CSS-Code not filling up 100% of the screen? I’ve 5 columns with a width of 20% percent floating left.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <style type="text/css" media="screen">
        body {
            padding: 0;
            margin: 0;
        }
        #container {
            width: 100%;
            background-color: red;
            height: 42px;
        }

        ul {
            padding: 0;
            margin: 0;
            width: 100%;
            overflow: hidden;
            list-style-type: none;
            float: left;
            white-space: nowrap;
            display: inline;
            height: 42px;
        }

        li {
            float: left;
            width: 20%;
            padding: 0;
            background-color: #000000;
            display: inline;
        }

        a {
            text-decoration: none;
            color: #333;
            text-align: center;
            display: block;
            height: 42px;
            line-height: 42px;
            white-space: nowrap;
            overflow: hidden;
            font-size: 0.9em;
            width: auto;
        }
        a:hover {
            background-color: #ccc;
            color: #FFF;
        }

    </style>
</head>
<body>
    <div id="container">
        <ul>
            <li>
                <a href="#">Home</a>
            </li>
            <li>
                <a href="#">Services</a>
            </li>
            <li>
                <a href="#">Portfolio</a>
            </li>
            <li>
                <a href="#">Clients</a>
            </li>
            <li>
                <a href="#">Articles</a>
            </li>
        </ul>
    </div>

</body>

There is always a red area on the right side, but 5*20% = 100% so that can’t be. What is wrong?

Kind regards,
PP

  • 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-13T04:57:21+00:00Added an answer on June 13, 2026 at 4:57 am

    I can see this issue in Safari. It only occurs sometimes when resizing the browser. It seems to be a rounding problem in WebKit browsers. I found this similar qwuestion “100% width divs not spanning entire width of the browser in webkit” with this comment:

    Thanks for the suggestions, unfortunately the issue persists. I think I’ve narrowed it down to Safari and Chrome rounding %-based widths to 1/2 of a percent (and no further) which results in the left over space unless the total width is “pixel-perfect”. Maybe I can think up a way to trick the browser into calculating it correctly, but the solution still eludes me at the moment.

    Maybe you can use display: table-cell on the <li>-tags to avoid this problem, as this should force the browser to always use the 100% width.

    Example HTML

    ​<div>
        <ul>
            <li><a href="">Value 1</a></li>
            <li><a href="">Value 2</a></li>
            <li><a href="">Value 3</a></li>
            <li><a href="">Value 4</a></li>
            <li><a href="">Value 5</a></li>
        </ul>
    </div>​​​​​​​​​​​​​​​​​​​​​​
    

    Example CSS

    ​ul {
        display: table;
        width: 100%;
        min-width: 400px;
        margin: 0;
        padding: 0;
        background: red;
        list-style: none;
    }
    
    li {
        display: table-cell;
        width: 20%;
        margin: 0;
        padding: 0;
        text-align: center;
        background: green;
    }
    
    li > a {
        display: block;
        height: 42px;
        line-height: 42px;
        background: #ccc;
    }
    

    Try before buy

    http://jsfiddle.net/Fsjns/

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

Sidebar

Related Questions

I have the following html/css code . When I have the screen resolution to
I have the following CSS code: .yellow { background-image: url('/images/yellowlight.png'); background-repeat: no-repeat; height:100%; width:100%;
Consider the following HTML/css code sample: <div id="container"> <div id="up">Text<br />Text<br />Text<br /></div> <div
I have the following code CSS select.select { color:#FFFFFF; height: 15px; width: 105px; background:#996633
I have the following html and css code: <!DOCTYPE HTML> <html> <head> </head> <body>
my following css code does not work in msie. #block a { border-right: 2px
am using the following css code for the style, but it is not working
I have a problem with a following HTML/CSS code: CSS * { padding: 0;
Hei , Following is my html code and css . I dont want to
I have the following code: CSS part: <style type=text/css> .menu { width:200px; } .menu

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.