您如何给< hr>渐变色? [英] How do you give a <hr> a gradient color?

查看:180
本文介绍了您如何给< hr>渐变色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的html页面上有一条水平线,并应用了以下样式:

I have a horizontal rule on my html page with the following styling applied:

#seperate {
    clear: both;
    border: 3px solid red;
}

是否可以使水平尺的颜色渐变类似于: p>

Is it possible to make the horizontal rule's colour a gradient similar to:

background: linear-gradient(to right, red , yellow)

我尝试这样做。.

#seperate {
clear: both;
border: 3px solid linear-gradient(to right, red , yellow);
}

..但是失败了。

推荐答案

是的,只需为 hr

hr {
  background: linear-gradient(to right, red, yellow);
  height: 5px;
}

<hr/>

这篇关于您如何给&lt; hr&gt;渐变色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆