2016-06-12 22 views
0

我在我的HTML中有textarea。對於元素,我使用codemirror.jscodemirror.css模塊(的CodeMirror)。當使用CodeMirror模塊時,無法重新調整HTML textarea元素的大小

<md-content flex style="display: flex; flex-flow: column;"> 
    <textarea id="textArea" style="flex:1"></textarea> 
</md-content> 

我使用單獨的JavaScript文件來操作模塊。

var textArea = document.getElementById('textArea'); 
CodeMirror.fromTextArea(textArea, { 
    lineNumbers: true 
}); 

當我在瀏覽器文本區域打開此被自動在窗口中水平地填充而不是垂直方向(寬度:100%&高度:50%)。 我試着加入<style>並設置寬度和高度。但它沒有改變。

<textarea id="textArea" style="flex:1; width:200px; height:300px"></textarea> 

此外,我試着用JavaScript改變CSS,再次,它沒有改變元素的大小。

textArea.style.width = 200; 
textArea.style.height = 300; 

我想這<textarea><md-content>填補,這就是爲什麼我用flex:1。我如何更改大小以填充父標記的區域(與父項md-content的大小相同)。

這是complete code

+0

你能添加一個小提琴嗎? – Roysh

+0

如何添加一個? – CoderS

+0

https://jsfiddle.net – Roysh

回答

2

https://jsfiddle.net/e86pztkh/1/

.CodeMirror { 
    position: relative !important; 
    height: 100% !important; 
} 
html, body{ 
    min-height: 100%; 
    position: relative; 
    height: 100%; 

}

不知道你是否有codemirror css文件在本地,如果你只需要修改它並轉儲!重要宣言。

相關問題