【问题标题】:How to have vertical gradient lines become horizontal?如何让垂直渐变线变为水平?
【发布时间】:2022-01-17 05:58:21
【问题描述】:

如何让这些垂直线变成水平线? https://jsfiddle.net/0b7qydhv/

在 sn-p 中,行当前是垂直的。

另外,我不希望这些台词重复。

所以图像看起来像这样:

我试着做0度

到底部也没有用。

它应该与底部一起使用,但它不是。

body {
   background: linear-gradient(to right, white 0, white 72px, red 72px, red 74px, white 74px, white 108px, red 108px, red 110px, white 110px, white 144px, red 144px, red 146px, white 146px, white 180px, red 180px, red 182px, white 182px, white 216px, red 216px, red 218px, white 218px, white 252px, red 252px, red 254px, white 254px, white 288px, red 288px, red 290px, white 290px, white 360px);
}

【问题讨论】:

  • to bottom + min-height:100% on the html element

标签: css linear-gradients


【解决方案1】:

试试这个。

body {
  background-image: linear-gradient(to bottom, red 1px, white 1px);
  background-size: 72px 72px;
}

【讨论】:

  • 我不想让这些台词重复。
  • 这不好。我想要 7 行间隔,但是我想要它们。垂直怎么没问题:jsfiddle.net/kt26pf8b/1
  • 但是您的垂直示例仅在小视口中产生 7 行?将您的 sn-p 检查为“整页”。如果您缩放浏览器,线条会变得不稳定。所以,我认为你不能单独用 css 完成你想做的事情。也许使用 SASS 迭代背景 7 次可以工作,但在我看来,你应该只使用实际图像。
  • 感谢您提供的信息。
  • 又想到了一件事....如果您仍然使用静态尺寸,您可以将该线性渐变应用到 div 而不是 body 并分配一个特定的高度....您会必须做数学,但你可以这样得到你的 7 行。不优雅,但可以工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多