html - 如何在CSS中制作内部边框半径?

标签 html css css-shapes

如何使边框半径向内?

.circle {
   width:100px;
   height:100px;
   background-color:solid red;
   border-radius:-50px 50px -50px [enter image description here][1]50px;
 }

我知道 -50px 是 Not Acceptable ,但我只是举一个理论上的例子。
请参阅下图以供引用。

enter image description here

最佳答案

也许有一些径向渐变:

body {
 background:linear-gradient(pink,yellow);
 height:100vh;
 margin:0;
}

.box {
  width:150px;
  height:150px;
  margin:10px;
  border-radius:50%;
  overflow:hidden;
  position:relative;
}
.box:before {
  content:"";
  position:absolute;
  top:0;
  bottom:50%;
  left:0;
  right:0;
  background:radial-gradient(circle at top left,transparent 44%, red 44.5%);
}
.box:after {
  content:"";
  position:absolute;
  bottom:0;
  top:50%;
  left:0;
  right:0;
  background:radial-gradient(circle at bottom left,transparent 44%, red 44.5%);
}
<div class="box">
</div>

关于html - 如何在CSS中制作内部边框半径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49310279/

相关文章:

php - 在 HTML 输入值的 php 变量字符串中正确连接 if isset

html - CSS - 带有切 Angular 和边框颜色的矩形 div

css - 屏幕中间的 HTML 列

html - IPAD 的 CSS 样式不起作用

html - 在 flexbox 中将文本居中放置在图像上

css - 展开圆的宽度

css - 使用线性渐变将CSS圆分成3个相等的部分-饼图样式

jquery - 在打印时隐藏调整大小功能

php - 如何使用 PHP 在表中保存禁用的组合框和单选按钮

用于动态 HTML 表格生成的 Javascript 库