扫码关注官方订阅号
如图示,底部的弧度效果除了用背景图外,还有其他什么方法吗,用border-radius写了下效果不佳
用border-radius 是可以的,只要定义好p的中心位置以及直径。
既然上面都说border-radius,那我给个其他的思路,用SVG。
用一个长方形在用border-buttom-radius
<style type="text/css"> .box { position: relative; width: 100%; height: 200px; text-align: center; color: #fff; background-color: #27ae60; } .box:after { position: absolute; left: 0; right: 0; bottom: -100px; z-index: -1; content: ' '; height: 200px; width: 100%; border-radius: 0 0 50% 50%; background-color: #27ae60; } </style> <p class='box'>hello world</p>
做个大尺寸的圆形p,根据弧的宽高计算出圆直径,圆心位置和p的位置,隐藏多余的部分。定位好后作为背景,覆盖个填充内容的透明层。
canvas
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
用border-radius 是可以的,只要定义好p的中心位置以及直径。
既然上面都说border-radius,那我给个其他的思路,用SVG。
用一个长方形在用border-buttom-radius
做个大尺寸的圆形p,根据弧的宽高计算出圆直径,圆心位置和p的位置,隐藏多余的部分。定位好后作为背景,覆盖个填充内容的透明层。
canvas