- Electron Projects
- Denys Vuika
- 206字
- 2021-06-24 12:14:35
Fitting the screen size
If you keep experimenting with your application at runtime, you may notice that the editor component doesn't fit the whole application area once you start resizing the window or maximizing it. To address this, we need to add some CSS styles to tell the component it needs to fit the parent width and height.
Please note that, at the lower level, SimpleMDE wraps another great component called CodeMirror.
CodeMirror is a versatile text editor that's implemented in JavaScript for the browser. It is specialized for editing code and comes with a number of language modes and addons that implement more advanced editing functionality.
Here, we are going to add flex layout features to the whole body of the HTML base and add some styling support for the CodeMirror part, which is part of SimpleMDE. Let's get started:
- Update the styles in the index.html file according to the following code:
<style>
html, body {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
}
.CodeMirror {
flex: 1;
}
</style>
- Run the application and try resizing the window to make it wider or taller. Notice that, now, the markdown editor area perfectly fits the entire page area:

Now, let's move on to integrating the application menu.
推薦閱讀
- OpenCV for Secret Agents
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Windows Forensics Cookbook
- 零基礎入門學習Python(第2版)
- Bootstrap 4 Cookbook
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Mastering Python Design Patterns
- Delphi開發典型模塊大全(修訂版)
- ASP.NET 4.0 Web程序設計
- Python一行流:像專家一樣寫代碼
- Web前端開發最佳實踐
- Mastering Bootstrap 4
- Getting Started with hapi.js
- JSP應用與開發技術(第3版)
- 趣味掌控板編程