![](/img/trans.png)
[英]How can I get my linear-gradient over an image the same size as the image in css?
[英]How can I add a linear-gradient colour to my underline for my heading?
我在我正在建設的網站上加了下划線,可以正常為其着色,但是在向其中添加線性漸變顏色時我很掙扎。
我采取了將標題的部分放寬並為border-bottom
着色的方法,這似乎可行,但是邊框太低而不能成為下划線。
編碼是這樣的:
span {
border-bottom: 5px solid transparent;
border-image: linear-gradient(to right, #7228fe 0%, #4ea2f5 100%);
border-image-slice: 1;
float: center;
margin-bottom: -5px;
line-height: 20px;
padding-bottom: 0px;
}
我建議您將標題放在div
然后使用CSS定位div
。
.box { border-bottom: 5px solid transparent; border-image: linear-gradient(to right, #7228fe 0%,#7228fe 60%, #4ea2f5 61%, #4ea2f5 100%); border-image-slice: 1; }
<html> <body> <div class="box"> <h1>box</h1> </div> </body> </html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.