简体   繁体   English

如何在图像顶部创建弯曲的背景

[英]how to created a curved background on top of image

I have this design 我有这个设计 在此处输入图片说明

How can I make the blue curved background on top of the image ( I need the transparency as well ) ? 如何在图像顶部制作蓝色弯曲的背景( 我也需要透明度 )?

I started it with a different backgournd but I don't know where to go from there. 我从另一个背景开始,但我不知道从那里去。 Any help will be really appreciated. 任何帮助将不胜感激。

 .bg { background-image:url("https://s8.postimg.cc/rsxes8dx1/red_or_blue_pill_crimson_quill-12.jpg"); max-width: 100%; height: 200px; background-size: cover; background-position: center; position: relative; } .bluebg { background-color: blue; position: absolute; } 
 <div class="bg"> <div class="bluebg"> </div> </div> 

https://jsfiddle.net/0rsLxtw5/7/ https://jsfiddle.net/0rsLxtw5/7/

I changed your HTML like the parent as child and child as parent. 我更改了您的HTML,例如将父级更改为子级,将子级更改为父级。

 .bg { background-image: url("https://s8.postimg.cc/rsxes8dx1/red_or_blue_pill_crimson_quill-12.jpg"); max-width: 100%; height: 200px; background-size: cover; background-position: center; position: relative; -webkit-clip-path: circle(50% at 98% 50%); clip-path: circle(50% at 98% 50%); } .bluebg { background-color: blue; position: absolute; height: 200px; width: 100%; } 
 <div class="bluebg"> <div class="bg"> </div> </div> 

I hope the below-given snippet helps! 希望下面提供的摘录对您有所帮助!

 .bg { background-image: url("https://s8.postimg.cc/rsxes8dx1/red_or_blue_pill_crimson_quill-12.jpg"); height: 200px; background-size: cover; background-position: center; overflow: hidden; } .bluebg { background: rgba(135, 206, 235, 0.5); height: 140%; width: 90%; -webkit-mask-image: radial-gradient(circle at right, transparent 0, transparent 30%, black 30px); mask-image: radial-gradient(circle at right, transparent 0, transparent 30%, black 30px); } 
 <div class="bg"> <div class="bluebg"></div> </div> 

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

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