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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:20:33+00:00 2026-06-11T16:20:33+00:00

There are already many questions raised about CSS & remaining width. After reading them

  • 0

There are already many questions raised about CSS & remaining width. After reading them I still have a problem I cannot fix. When trying to let an input element use up the remaining width it is always 4px wider than its containing div.

<!DOCTYPE html>
<html>
<body>
    <div>
        <div style='float:left; margin-right:10px;'>Hello:</div>
        <div style='overflow:hidden'><input style='width:100%'/></div>
    </div>
</body>
</html>

The input element is always 4 pixels too wide to show its right border. If I set the margin-left of the input to -4px it becomes visible but then the left border is not shown.

Tested this with Chrome.

  • 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-11T16:20:35+00:00Added an answer on June 11, 2026 at 4:20 pm

    You could add box-sizing: border-box; to your input to avoid the overflow. What it does basically is that the borders and padding will be taken into consideration when setting width: 100%. Note that you’d have to include several vendor-prefixed for different browsers:

    .myinput {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border: 2px solid orange; /*just to make border more clear*/
        width: 100%;
    }
    

    Little demo: little link.

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

Sidebar

Related Questions

There have been many debates about this topic already here, but none of them
There are already questions regarding unicode and ini files, but many of them are
There are already so many questions asked about this already. One popular answer is
I have gone through many questions already asked about this problem but i didn't
I know there are already many questions like mine but I found no answer
First of all: I do know that there are already many questions and answers
There are already lots of questions on SO about exceptions, but I can't find
I know there are many similar questions already, but I've spent hours trying to
friends. I know, there are many questions here already on these iterators. I've read
There are many similar questions, but I have not found exactly what I am

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.