文本区域根据焦点调整大小并离开

Textarea resizes on focus and leave

我遇到了一个以前从未遇到过的问题:一个普通的旧常规 html textarea 会根据焦点调整大小。

即使我设置了所需区域的高度,它仍然会调整为更小或更大的大小,并且没有明显的相关性。我试图删除我在该项目上的所有 类,但没有成功。


这是bootstrap嘛?
我该如何解决?

link给短视频的问题:
https://www.dropbox.com/s/7329y5a96ixajl4/18-34-46.wmv?dl=0

<textarea style="min-height: 150px; height: 150px; 
   max-width: 100%;" type="text" name="jobDesc" 
   ng-model="req.jobDesc" placeholder="Write a description for the assignment">
</textarea>

Try using rows Attribute:

<textarea rows="4" >
This should force the text area to only show 4 lines, or 5, as you desire. 
</textarea>

Anyway, I think you can check the size of your text area or the calculated properties, clicking on "inspect" on your browser (for example chrome). Then click on Styles/Computed and you will see the styles you are applying.

属性图片:

编辑:

I´ve tried to make a fiddle to think about which property is breaking it, try it. It it seems you need to look for a textarea:focus or similar inside your css`s :)

Changed snippet to show how also padding property can affect the size

#editor1 {height: 10px;}
#editor1:focus {height: 20px;}

#editor2:focus { padding-bottom: 10px;}
<textarea id="editor1" placeholder="Check it!!"></textarea>
<textarea id="editor2" placeholder="Check it!!"></textarea>

解决后通过 OP 的评论进行了改进:

I did actually manage to find out what caused the problem. Hidden in one of the js files was some legacy code to manage resizing of textareas. As some of the pages where loading in templates on top of the actual page(in a aside/modal) the code wasnt running correctly. Thank you for taking the time. It led me to my