简体   繁体   English

CSS-绘制带有圆角的矩形作为背景

[英]Css - Draw rectangle with rounded corners as background

Is any ways to make this figure with only html & css? 有什么办法只用html和css来制作这个数字吗?

在此处输入图片说明

Almost the same solution as @pedram, but using pseudo element in order to avoid inverse skewing the content inside the div (if there will be a content) : 几乎与@pedram相同的解决方案,但是使用伪元素以避免将div中的内容反向倾斜 (如果有内容的话):

 div.content { width: 200px; height: 200px; position:relative; padding:20px; box-sizing:border-box; } div.content:before { content:""; position:absolute; background: #ff8f00; border-radius: 15px; transform: skew(-5deg); top:0; left:0; right:0; bottom:0; z-index:-1; ] 
 <div class="content"> lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume lorem ipsume </div> 

You should use transform skew like below, and your shape called Parallelogram 您应该使用如下所示的transform skew ,并且将形状称为Parallelogram

 div { width: 200px; height: 200px; background: #ff8f00; border-radius: 15px; transform: skew(-5deg); /* OR transform: skew(-190deg); */ position: relative; left: 20px; top: 10px; } 
 <div> </div> 

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

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