【问题标题】:How do I change the direction of a gradient in tailwind css?如何更改顺风 css 中渐变的方向?
【发布时间】:2022-01-20 00:05:49
【问题描述】:
 <div class="bg-gradient-to-r from-cyan-500 to-blue-500 ">

。 . . .

我已经尝试了上面的代码。但它是线性渐变,我想要一个垂直渐变。

【问题讨论】:

  • 尝试使用 bg-gradient-to-t 或 bg-gradient-to-b

标签: gradient tailwind-css direction


【解决方案1】:

但它是线性渐变,我想要一个垂直渐变。

linear 是一种渐变,vertical 是一种方向。你可能意味着你有水平渐变并且你想要垂直。不过他们都是linear

可用于线性渐变的所有默认可用方向:

  • bg-渐变到-t
  • bg-渐变到-tr
  • bg-渐变到-r
  • bg-渐变到-br
  • bg-渐变到-b
  • bg-gradient-to-bl
  • bg-gradient-to-l
  • bg-渐变到tl

所以对于垂直方向,只需使用bg-gradient-to-t(从下到上)或bg-gradient-to-b(从上到下)

More info in the docs

【讨论】:

    猜你喜欢
    • 2021-03-02
    • 1970-01-01
    • 2021-05-28
    • 2016-08-21
    • 2021-11-06
    • 2020-08-01
    • 1970-01-01
    • 2023-04-07
    • 2022-01-11
    相关资源
    最近更新 更多