How can I make a TextArea 100% width without overflowing when padding is present in CSS?

前端 未结 15 2160
失恋的感觉
失恋的感觉 2020-11-29 14:44

I have the following CSS and HTML snippet being rendered.

<
15条回答
  •  温柔的废话
    2020-11-29 15:11

    If you're not too bothered about the width of the padding, this solution will actually keep the padding in percentages too..

    textarea
    {
        border:1px solid #999999;
        width:98%;
        margin:5px 0;
        padding:1%;
    }
    

    Not perfect, but you'll get some padding and the width adds up to 100% so its all good

提交回复
热议问题