html - 如何仅使用 HTML CSS 制作圆圈?

标签 html css

Image

我有上面的图片,我想用 HTML CSS 制作这个循环结构。

HTML:

<div class="circle"></div>

CSS:

.circle {
   width: 96px;
   height: 96px;
   background: #eee;
   border-color: red;
   border-style: solid;
   border-radius: 100%;
   position: relative;
}

请帮助我使用 HTML CSS 创建 Circle 的内部结构,如上图所示,在此先感谢 :)

最佳答案

使用这个CSS

#yin-yang { 
  width: 96px;
  height: 48px;
  background: #eee; 
  border-color: red; 
  border-style: solid; 
  border-width: 2px 2px 50px 2px; 
  border-radius: 100%;
  position: relative;
}

#yin-yang:before { 
  content: "";
  position: absolute;
  top: 50%; 	left: 0;
  background: #eee;
  border: 18px solid red;
  border-radius: 100%;
  width: 12px;
  height: 12px;
} 

#yin-yang:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: red;
  border: 18px solid #eee;
  border-radius:100%;
  width: 12px;
  height: 12px;
} 
<div id="yin-yang"></div>

关于html - 如何仅使用 HTML CSS 制作圆圈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36350526/

相关文章:

css - 为什么 <table> 不适合布局而 <div> 适合?对于屏幕阅读器用户

css - 从 Angular Material 的下拉列表中为每个选项显示不同颜色的内容详细信息

java - primefaces 组件未使用数据领域正确呈现

ruby-on-rails - Rails,在 form_for 标签自定义文本中插入 span 标签

html - 单击时将 div 的 Angular 设置为不同的颜色

html - 将内联 css 移动到定义中

jquery - 打开响应菜单时在 Bootstrap 3 站点中覆盖内容区域

html - Angular 横幅 - 添加到页面

Javascript 或 Jquery 检测页面刷新并重定向到错误页面 - 避免重复数据提交

javascript - 如何在响应菜单上的导航链接悬停时设置下划线?