Created
December 4, 2012 09:23
-
-
Save marijnh/4202141 to your computer and use it in GitHub Desktop.
CodeMirror almost full height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Demo</title> | |
<link href="lib/codemirror.css" rel="stylesheet"> | |
<style type="text/css"> | |
html, body { height: 100%; margin: 0; padding: 0; } | |
.wrap { | |
position: relative; | |
height: 100%; | |
background: #eee; | |
padding: 20px; | |
box-sizing: border-box; | |
} | |
.border { | |
-webkit-border-radius: 5px; | |
-moz-border-radius: 5px; | |
border-radius: 5px; | |
border: 1px solid #999; | |
position: relative; | |
height: 100%; | |
padding: 1px; | |
} | |
.CodeMirror { | |
height: 100%; | |
background: white; | |
} | |
</style> | |
<script src="lib/codemirror.js"></script> | |
</head> | |
<body> | |
<div class=wrap><div class=border><textarea id="code"></textarea></div></div> | |
<script> | |
(function() { | |
// Create a CM instance | |
var ed = CodeMirror.fromTextArea(document.getElementById("code"), { | |
lineNumbers: true, | |
lineWrapping: false, | |
readOnly: true | |
}); | |
var content = "foo\nbar\nbaz\nquux\n"; | |
for (var i = 0; i < 10; ++i) content += content; | |
ed.setValue(content); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know who you are, and you don't know me, but you just saved my bacon.