html - 如何在 CSS3 中绘制自定义圆形?

标签 html css shapes css-shapes

我正在尝试绘制这个特定的形状:

enter image description here

它必须有两个直面,除了半圆形之外,我无法创造出更好的形状。是否有可能以某种方式使用 CSS 从圆圈中减去这些部分,或者我应该直接从 .psd 文件中提取图像?

最佳答案

在属性后使用 css 来实现,如下所示:

#circle {
    width: 100px;
    height: 100px;
}
#circle:after {
    width: 100px;
    height: 100px;
    background: red;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    display: block;
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
}

在 html 中:

<div id="circle"></div>

关于html - 如何在 CSS3 中绘制自定义圆形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21379113/

相关文章:

css - 只有溢出时才能看到滚动条

html - Bootstrap 轮播下方的文字?

javascript - 在谷歌地图 v3 中绘制可拖动形状

java - 绘制矩形

c# - 如何将 Storyboard 用作样式

html - 固定菜单位置,主体高度为 100%

html - 可以设置 css3 resize 函数的样式吗?

iOS 7 悬停/点击问题 - 在某些情况下不会触发点击

webkit - CSS3 框阴影方向

css - 如何使元素相对于标题居中?