简体   繁体   English

CSS 100vh 不占用整个视口

[英]CSS 100vh not taking entire viewport

I need help with my css.我需要有关我的 css 的帮助。 I wanted the background to take up the entire viewport using 100vh but it's not working.我希望背景使用 100vh 占据整个视口,但它不起作用。 The meta tag for the viewport is already included.视口的元标记已经包含在内。 The box-sizing is already set up as well.盒子尺寸也已经设置好了。 When I tried inspecting the page using the chrome dev tool, there seems to be no margin or padding creating the space below.当我尝试使用 chrome dev 工具检查页面时,似乎没有边距或填充来创建下面的空间。 BTW I'm using Bulma CSS.顺便说一句,我正在使用布尔玛 CSS。

<section class="section is-paddingless>
    <div class="columns is-vcentered has-background-primary" style="height: 100vh">
       <div class="column is-4 is-flex">
          <div class="container">Sample text</div>
       </div> 
    </div>
</section>

在此处输入图片说明

A. section class attribute has a missing quote symbol " . Change it from: <section class="section is-paddingless> To: <section class="section is-paddingless"> A. section 类属性缺少引号 " 。将其从: <section class="section is-paddingless>为: <section class="section is-paddingless">

B. Add is-marginless class to the section's child div. B. 将is-marginless类添加到该部分的子 div。

Final html:最终的html:

<section class="section is-paddingless">
    <div class="columns is-vcentered has-background-primary is-marginless" style="height: 100vh">
       <div class="column is-4 is-flex">
          <div class="container">Sample text</div>
       </div> 
    </div>
  </section>

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

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