Search code examples
csswidthrenderingpixelpercentage

One pixel extra with a width of 100%


I got a textarea of 680 pixels wide. This needs to be made fluid so I use percentages.

The percentages make a perfect 100% width but it seems to render 1 pixel more than it should.

http://jsfiddle.net/XXshn/2/


Solution

  • And what would be wrong with this:

    textarea {
    border: 1px solid #333333;
    background: #ececec;
    margin: 0;
    outline: 0;
    height: 100px;
    padding: 20px; /*  */
    width: 640px; /* 680px - 2 * 20 */
    resize: none; }