Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何适应屏幕的高度?_Html_Css - Fatal编程技术网

Html 如何适应屏幕的高度?

Html 如何适应屏幕的高度?,html,css,Html,Css,我正试图使这个响应性强的网页适应浏览器的高度(没有垂直滚动),我感到困惑。。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明的孩子也变傻 HTML: <header class="mainHeader"> <a href="/home/show"> <img src="/assets/EagleLogo.png" alt="" /> </a> <nav&g

我正试图使这个响应性强的网页适应浏览器的高度(没有垂直滚动),我感到困惑。。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明的孩子也变傻

HTML:

  <header class="mainHeader">
  <a href="/home/show">
    <img src="/assets/EagleLogo.png" alt="" />
  </a>
    <nav>
      <ul>
        <li><a href="/products/supertherm" class="hvr-underline-from-center">SuperTHERM<sup>®</sup></a></li>
        <li><a href="/products/rustgrip" class="hvr-underline-from-center">RustGRIP<sup>®</sup></a></li>
        <li><a href="/products/hotpipe" class="hvr-underline-from-center">Hot-PIPE<sup>®</sup></a></li>
      </ul>
      <div class="search"><a href="#"><img src="/assets/mg.png" alt="" /></a>
      </div>
      <div class="product-inventory"><a href="/products/index"><img src="/assets/inventory.png" alt="" /></a>
      </div>
    </nav>
  </header>

<hr>

  <div class="mainContent-container">
    <img class="thermal" src="/assets/thermal.png" alt="" />
    <img class="corrosion effect2"src="/assets/co.png" alt=""/>
    <img class="fire effect2"src="/assets/fire.png" alt="" />
       <p class="intro"></p>
  </div>

  <img src="/assets/phone.png" alt="" height="75px" width="75px" align="middle" />

  <footer class="mainFooter">  </footer>
.mainHeader img {
width: 30%;
height: auto;
}

.mainHeader nav {
height: 40px;
margin-top: -4%;
text-align: center;
}

div.mainContent-container {
// width: 80%;
margin: 3% 10% -3% 10%;
position: relative;
list-style: none;

.intro {
padding: .1% 1% 0 1%;
margin-top: 1%;
width: 95%;
text-align: center;
font-size: 1.5em;
font-family: 'Raleway';
font-weight: 500;
}

img[src="/assets/phone.png"] {
margin: 3.5% 46.9% 4% 46.9%;
}

.mainFooter {
 margin: 0 0 5% 28.3%;
}
只工作不玩耍,聪明的孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明孩子也变傻。只工作不玩耍,聪明的孩子也变傻

这肯定是我读过的最令人困惑的一句话

至于你的问题,以前已经回答过很多次了

此外,让所有东西都适合身高可能不是很灵敏,相反,你应该关注宽度

例如,拿一部水平翻转的手机来说,它会把设计挤压得太厉害

如果你坚持

html,body{height:100%;margin:0 0;padding:0 0;}

似乎引入填料是为了绕过Stackoverflow对立柱长度的要求。试图删掉填充词会让人抱怨这篇文章“大部分是代码”,你很聪明。这是有道理的。不过,如果我必须说的话,这是一个非常明智的说法。为了适应屏幕的高度,请使用“height:100vh”作为宽度,使用“width:100vw;”。