【问题标题】:Expand an element's height to the bottom of the page with TailwindCSS使用 TailwindCSS 将元素的高度扩展到页面底部
【发布时间】:2021-02-07 21:06:18
【问题描述】:

如何将第三个元素展开到页面底部?我测试了很多h-full,但是元素的高度变成了屏幕的高度,所以右边有一个滚动条,对象太高了。我只是希望它适合页面的其余部分。

html, body {
  height: 100%;
}
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">

<div class="text-gray">
  
  <nav class="fixed flex shadow-md w-full bg-blue-700 p-3">
<div>
  <span class="text-xl">Navbar</span>
</div>    
  </nav>
  
  <div class="pt-16 px-2">
<div class="bg-orange-200">object1</div>
<div class="bg-red-200">object2</div>
<div class="bg-blue-200">object3</div>
  </div>
  
</div>

【问题讨论】:

    标签: css tailwind-css


    【解决方案1】:

    您可以尝试如下:

    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
    
    <div class="text-gray">
    
      <nav class="fixed flex shadow-md w-full bg-blue-700 p-3"> 
        <div>
          <span class="text-xl">Navbar</span>
        </div>
      </nav>
    
      <div class="pt-16 px-2 h-screen flex flex-col"> <!-- 3 classes here  -->
        <div class="bg-orange-200">object1</div>
        <div class="bg-red-200">object2</div>
        <div class="bg-blue-200 flex-grow">object3</div> <!-- 1 classe here  -->
      </div>
    
    </div>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-30
      • 2012-11-06
      • 2015-07-20
      • 2012-04-02
      • 2014-07-23
      • 2013-07-05
      • 2018-04-25
      相关资源
      最近更新 更多