Javascript 使用CodeMirror模块时无法重新调整HTML textarea元素的大小

Javascript 使用CodeMirror模块时无法重新调整HTML textarea元素的大小,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我的HTML中有一个textarea。对于元素,我使用了codemirr.js和codemirr.css模块(of) 当我在浏览器中打开此窗口时,文本区域会在窗口中自动水平填充,但不会垂直填充(宽度:100%,高度:50%)。 我尝试添加并设置宽度和高度。但这并没有改变什么 <textarea id="textArea" style="flex:1; width:200px; height:300px"></textarea> 我想在中填写,这就是我使用flex:1的原

我的
HTML
中有一个
textarea
。对于元素,我使用了
codemirr.js
codemirr.css
模块(of)

当我在浏览器中打开此窗口时,文本区域会在窗口中自动水平填充,但不会垂直填充(宽度:100%,高度:50%)。 我尝试添加
并设置宽度和高度。但这并没有改变什么

<textarea id="textArea" style="flex:1; width:200px; height:300px"></textarea>
我想在
中填写
,这就是我使用
flex:1
的原因。如何更改大小以填充父标签的区域(与父标签的大小相同)

这是

}

不确定您是否在本地拥有codemirror css文件,如果您只是修改它并转储!重要声明。

}


不确定您是否在本地拥有codemirror css文件,如果您只是修改它并转储!重要声明。

您可以添加小提琴吗?我如何添加?@Roysh请在中找到JSFIDLE,这是您想要的吗?-你能加一把小提琴吗?我怎么能加一把?@Roysh请在中找到JSFIDLE,这是你想要的吗-
var textArea = document.getElementById('textArea');
CodeMirror.fromTextArea(textArea, {
  lineNumbers: true
}); 
<textarea id="textArea" style="flex:1; width:200px; height:300px"></textarea>
textArea.style.width = 200;
textArea.style.height = 300;
.CodeMirror {
  position: relative !important;
  height: 100% !important;
}
html, body{ 
  min-height: 100%;
  position: relative;
  height: 100%;