How to make a textbox and a textarea same width cross-browsers?

前端 未结 8 1604
孤街浪徒
孤街浪徒 2021-02-19 22:23

Setting the width of both the textbox (ie. input type=\"text\") and the textarea to 500px doesn\'t work in IE6 and Chrome, only works fine in FF2 (haven\'t tested other browsers

8条回答
  •  悲哀的现实
    2021-02-19 23:09

    I use CSS3 to make textbox and input work the same. See jsFiddle.

    .textarea, .textbox {
        width: 200px;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box; 
    }
    

    Works in IE8+, see caniuse.

提交回复
热议问题