1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > CSS背景图和渐变色共存

CSS背景图和渐变色共存

时间:2019-11-20 18:46:19

相关推荐

CSS背景图和渐变色共存

CSS背景图和渐变色共存

需求场景是在一个DOM元素上需要背景图和渐变色共存

实现

background: url(/imgextra/i4/1881744325/O1CN01JBktT81hotb8c6Py0_!!1881744325.png) center no-repeat,linear-gradient(to bottom,red,#3c3f40);

效果

代码

<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>css背景图和渐变</title><link rel="stylesheet" href=""><style type="text/css">*{padding: 0;margin: 0;}</style></head><body><style type="text/css">h1{height: 400px;text-align: center;background: url(/imgextra/i4/1881744325/O1CN01JBktT81hotb8c6Py0_!!1881744325.png) center no-repeat,linear-gradient(to bottom,red,#3c3f40);line-height: 400px;}</style><h1>css渐变和背景共存</h1></body></html>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。