如何使用Tailwind将横幅占据屏幕的75%。

huangapple go评论62阅读模式
英文:

how to make banner take up to 75% of the screen using tailwind`

问题

我一直在尝试让我的横幅显示到屏幕高度的大约75%,而不被裁剪。我没有使用h-screen,因为它会占满整个屏幕高度,而h-96太小了。如何获得所需的结果?

英文:

I've been trying to have my banner show till about 75% of the screen height without getting cropped. I didn't use h-screen cause it takes the full height of the screen and h-96 is too small. How do I get the desired result?

<!DOCTYPE html>
<html lang="en" class="dark">
  <head>
    <link href="/public/output.css" rel="stylesheet" />
    <title>Tailwind</title>
  </head>
  <body>
  <nav>
  The Navbar
  </nav>

 <!-- Banner -->
    <div class="bg-cover bg-center bg-no-repeat h-48 lg:h-96" style="background-image: url('https://source.unsplash.com/1280x614/?nature');">
    </div>
</body>
</html>

</details>


# 答案1
**得分**: 1

你可以使用模板:`h-[value]` 来设置所需的高度(也可以设置宽度)。

**例如:**

    h-[75%]

**或者**

    h-[100px]

<details>
<summary>英文:</summary>

You can set any required value for height (and for width too) using the 
template: `h-[value]`

**For example:**

    h-[75%]

**or**

    h-[100px]

</details>



huangapple
  • 本文由 发表于 2023年5月10日 16:22:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216320.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定