Apparently, when you set the width of a textbox, most browsers will add some pixels to it. I’m not entirely sure why they do this, but it can differ between browsers. To avoid this, you need to set the border of your textbox in CSS, and even then, you still need to subtract two pixels.

I made some fiddles to demonstrate what happens and how to solve it.

This is our initial problem:

So we set our border in CSS to 1 pixel, but it still isn’t enough:

So we have no other option than to set the width of our textbox separately:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.