简体   繁体   English

CSS-覆盖图像渐变

[英]CSS - Cover Image Gradient Over

I'm working to have a gradient layer over a cover image. 我正在努力在封面图像上放置一个渐变层。 I don't understand why its happening in this way. 我不明白为什么会这样发生。

Have a look on the below code. 看下面的代码。

Source: Wallpaper 来源: 墙纸

For instance: 例如:

 header { position: relative; height: 300px; background-repeat: no-repeat; background-position: center bottom; background-image: url('http://wallpaperlatest.com/wp-content/uploads/latest-wallpapers-in-full-hd-definition.jpg'); background-size: cover; border-bottom-left-radius: 50%; border-bottom-right-radius: 50%; } h1 { margin: 0; padding: 100px 0; font: 44px "Arial"; text-align: center; } header h1 { color: white; } 
 <header> <h1>Header Content | Source: http://wallpaperlatest.com</h1> </header> <section> <h1>Section Content | Source: http://wallpaperlatest.com/</h1> </section> 

Try this: 尝试这个:

 header { position: relative; height: 300px; background-repeat: no-repeat; background-position: center bottom; background-image: linear-gradient(to bottom right, rgba(0, 47, 75, .8), rgba(220, 66, 37, .8)), url('http://wallpaperlatest.com/wp-content/uploads/latest-wallpapers-in-full-hd-definition.jpg'); background-size: cover; border-bottom-left-radius: 50%; border-bottom-right-radius: 50%; } h1 { margin: 0; padding: 100px 0; font: 44px "Arial"; text-align: center; } header h1 { color: white; } 
 <header> <h1>Header Content | Source: http://wallpaperlatest.com</h1> </header> <section> <h1>Section Content | Source: http://wallpaperlatest.com/</h1> </section> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM