简体   繁体   English

CodeMirror响应式设计

[英]CodeMirror Responsive Design

So I am using CodeMirror to create an iOS Web App that teaches you how to use basic JavaScript and I only just realized that CodeMirror does not automatically resize to fit the screen of the device and the code doesn't fit on the screen... So I realy need to A. Either Make CodeMirror fit on the screen perfectly. 所以我使用CodeMirror创建一个iOS Web App,教你如何使用基本的JavaScript,我只是意识到CodeMirror不会自动调整大小以适应设备的屏幕,而且代码不适合屏幕......所以我真的需要A.要么让CodeMirror完美地适合屏幕。 Or B. Have a completly custom syntax highlighting textarea that is completly responsive. 或者B.使用完全自定义语法突出显示完全响应的textarea。

What you probably mean by fit on the screen perfectly is the default padding of the body. 您可能完全适合屏幕的意思是身体的默认填充。 To remove it: 要删除它:

body, html {
    padding: 0;
    margin: 0;
}

Next I would recommend this viewport: 接下来我会推荐这个视口:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">

If you want to change the font size you can do so like this: 如果要更改字体大小,可以这样做:

.CodeMirror {
    font-size: 20px;
}

And if the CodeMirror should be full height: 如果CodeMirror应该是全高:

.CodeMirror {
    height: 100vh;
}

DEMO: https://codepen.io/quic5/pen/maxjmB 演示: https//codepen.io/quic5/pen/maxjmB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM