Why don't <textarea> and <input> elements respect max-width?

后端 未结 3 1507
情话喂你
情话喂你 2021-01-19 00:34

The following HTML:


         


        
3条回答
  •  天命终不由人
    2021-01-19 00:57

    Most browsers respect max-width, but INPUT and TEXTAREA elements typically have a width set by default in the user agent CSS. You can add this CSS for a consistent rendering:

    input,textarea{width:100%;display:block}
    

提交回复
热议问题