CSS绘制圆弧

css绘制如图的圆弧:

这种矩形+弧形的效果中,弧形的效果一般是由一条曲线拉伸出来的,这条曲线往往是属于一个椭圆的,所以可以绘制一个椭圆,截取部分可视区域实现效果。

html 复制代码
  <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>
相关推荐
用户059540174467 小时前
AI记忆存储一致性踩坑实录:每天手工回归200条对话,直到我用pytest+Redis搭建自动化验证
前端·css
思码梁田1 天前
CSS letter-spacing 属性详解:掌控字符之间的呼吸感
前端·css
贾伟康1 天前
【安心陪诊 Agent v1.1】首页可信设计实战:HTML/CSS 状态卡与急症分流
css·html·harmonyos·ai agent·首页设计
AZaLEan__1 天前
CSS文档流相关:BFC
前端·css
‘’林花谢了春红‘’2 天前
小玩意 生日快乐
css·html·css3
梨想橙汁2 天前
CSS零基础入门:语法、引入方式与基础样式全解析
css
七牛开发者2 天前
RAG 工程里的上下文剪枝:如何减少 68% 的上下文
前端·css·github
叉歪2 天前
为 UnoCSS 扩展无限色阶与主题换色
前端·css
TheITSea2 天前
4、React+Tailwind CSS
前端·css·react.js
iCOD3R3 天前
Skill - kill-ai-slop 解决“AI 味”样式
前端·css·ai编程