如何使我的网站高度适应屏幕?

时间:2015-06-10 15:01:24

标签: jquery html css

我希望我的网页在宽度和高度上也适合屏幕。这怎么可能?我知道使用宽度的媒体查询。

如何设定身高?

请告诉我如何使用媒体查询来设置我的页面宽度和高度。

2 个答案:

答案 0 :(得分:0)

如果您希望所有浏览器都达到最大宽度和高度,请执行以下操作:

<body>
  <div class="container">
    <!-- Page content goes here -->
  </div>
</body>

在你的CSS中写下:

.container {
  height: 100vh;
  width: 100vw;
  overflow: auto;
}

答案 1 :(得分:0)

使网页获得完整的宽度和高度,并仍然响应。

您需要输入以下css。

body,
html {
  height: 100%;
}
.the_section_just_after_bodytag {
  position: relative;
  height: 100%;
}

希望这有效。

相关问题