您的位置:首页 > 娱乐 > 八卦 > CSS绘制圆弧

CSS绘制圆弧

2024/7/4 6:09:49 来源:https://blog.csdn.net/dbeidouxingf/article/details/139237908  浏览:    关键词:CSS绘制圆弧

css绘制如图的圆弧:
在这里插入图片描述
这种矩形+弧形的效果中,弧形的效果一般是由一条曲线拉伸出来的,这条曲线往往是属于一个椭圆的,所以可以绘制一个椭圆,截取部分可视区域实现效果。

  <style>
.wrapper{width: 400px;height: 600px;border: 2px solid saddlebrown;position: relative;overflow: hidden;
}.arc-continer{width: 100%;/* 高度设置为 圆弧形状整体高度 */height: 259px;background-color: transparent;position: relative;
}/* 绘制椭圆 :长半轴为容器宽度*2左右,短半轴为容器宽度*1 左右 -- 可以根据需要进行微调*/
.arc-continer::after{content: '';width: 200%;height:400px;background-color: aqua;position: absolute;/* 绘制为椭圆 */border-radius: 100% /100%;/* top 为  椭圆高度 - arc-continer高度*/top: -141px;left: 50%;transform: translateX(-50%);
}</style>
</head><body><div class="wrapper" id="wrap"><div class="arc-continer" id="continer"></div></div>
</body>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com