I want to make a very simple Monaco: JSBin editor :
<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <style> .me { height: 100vh; } </style> </head> <body> <div class="me" id="container"></div> <script src="https://www.matrixlead.com/monaco-editor/min/vs/loader.js"></script> <script> require.config({ paths: { 'vs': 'https://www.matrixlead.com/monaco-editor/min/vs' }}) require(["vs/editor/editor.main"], function () { var editor = monaco.editor.create(document.getElementById('container'), { value: 'function x() {\n\tconsole.log("Hello world!");\n}', language: 'javascript', minimap: { enabled: false }, scrollBeyondLastLine: false }); }); </script> </body> </html>
When I see this in Chrome and scroll up and down, there is a scroller for the whole window. This seems to be because the height of the editor is greater than the height of the window. I just don't want to see any scrollers. Does anyone know how to achieve this?
Edit 1: screenshot in Safari 10.1.2 with height: calc(100% - 24px)

Decision:
With the answers, here is a solution that works for me:
1), we need to check this in an independent html file, and not in JSBin
2) the key should use overflow: hidden
3), as a result, the following code does not create a scroll bar while scrolling up and down, there are no lines at the bottom of the line:
<html> <style> body { overflow: hidden; } .myME { height: 100% } </style> <body> <div class="myME" id="container"></div> <script src="https://www.matrixlead.com/monaco-editor/min/vs/loader.js"></script> <script> require.config({ paths: { 'vs': 'https://www.matrixlead.com/monaco-editor/min/vs' }}) require(["vs/editor/editor.main"], function () { var editor = monaco.editor.create(document.getElementById('container'), { value: 'function x() {\n\tconsole.log("Hello world!");\n}', language: 'javascript', minimap: { enabled: false }, automaticLayout: true, scrollBeyondLastLine: false }); }); </script> </body> </html>
javascript css height monaco-editor
SoftTimur
source share