简体   繁体   English

React JS - 应用程序没有填满整个页面

[英]React JS - app not filling the entire page

I am using React JS.我正在使用 React JS。 I have 3 components:我有3个组件:

  1. nav导航
  2. div div
  3. section部分

Folders:文件夹:

  • (Folder: Navbar.js, Navbar.scss) (文件夹:Navbar.js、Navbar.scss)
  • (Folder: MyDivSection.js, MyDivSection.scss) (文件夹:MyDivSection.js、MyDivSection.scss)
  • (Folder: MySection.js, MySection.scss) (文件夹:MySection.js、MySection.scss)
  • App.js (where all of the above components are called) App.js(上面所有的组件都在这里被调用)
  • index.js ( ReactDOM.render(, document.getElementById('root')); ) index.js ( ReactDOM.render(, document.getElementById('root')); )

Here is the layout of my page:这是我的页面布局: 页面布局

There is a white/empty area at the bottom of the page, that I want to get rid of using sass/css ?页面底部有一个白色/空白区域,我想摆脱使用 sass/css 吗?

How to achieve that ?如何做到这一点?

Note: The white/empty area appears only in 768px, 480px and 1200px resolutions注意:白色/空白区域仅在 768px、480px 和 1200px 分辨率下出现

If I understood the problem, Then you would have menu=nav , Content=div and section=footer.如果我理解了这个问题,那么你就会有 menu=nav 、 Content=div 和 section=footer 。

Then the height of the menu should be fixed where the content and footer could be in %.然后菜单的高度应该固定在内容和页脚可以以 % 为单位的位置。 this is the problem you are getting.这是你遇到的问题。

You need to increase the content so that it fills the white secion您需要增加内容以填充白色部分

Here is how I would do it.这是我将如何做到的。

 .app{ display:inline-block; width: 98vw; height:95vh; } .app> div{ width:100%; } .app .nav{ background:red; height:30px; } .app .content{ background:blue; height:75%; } .app .footer{ background:green; height:20%; }
 <div class="app"> <div class="nav">nav</div> <div class="content">div</div> <div class="footer">section</div> </div>

尝试阅读有关flexbox的一般信息,但这里有一些方便的布局示例可能会对您有所帮助

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

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