简体   繁体   English

如何使每个部分的高度相同?

[英]How can I make each section the same height?

I was wondering how I can make each section which is called #app , section2 and section3 the same height which is the full web page 100% like demonstrated in the #app section of my site. 我想知道如何使每个名为#appsection2section3具有相同的高度,这是整个网页的100%,就像在我的网站的#app部分中所展示的那样。 For example, I don't want to see the text "PART 3" when I'm at #section2 I want the height to of each section to be the equivalent of a single page. 例如,当我在#section2时,我不想看到文本“ PART 3”,我希望每个部分的高度等于单个页面的高度。

Here is an example of what I'm trying to achieve. 这是我要实现的示例

In order to make them all the same height I used the following CSS however, I'm obviously missing something as it's not working. 为了使它们都具有相同的高度,我使用了以下CSS,但是由于它无法正常工作,我显然缺少了一些东西。

body,
html {
    width: 100%;
    height: 100%;
}

#app
#section2,
#section3,{
  height: 100vh;
  width: 100%;
}

Here is a link to my site code using jsfiddle 这是使用jsfiddle指向我的网站代码的链接

#app,
#section2,
#section3 {
  height: 100vh;
  width: 100%;
}

Your initial CSS is improperly written so that the above code (corrected) is never properly applied. 您的初始CSS编写不正确,因此上述代码(已更正)从未正确应用。 Fix that and you're well on your way to achieving your desired results. 修复该问题,您将可以很好地实现预期的结果。

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

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