css - 中心只需要一个圆圈

标签 css linear-gradients radial-gradients

我只想要中心的一个圆圈而不是围绕它的圆圈。我不想更改当前代码(渐变样式)。我该如何实现?

 
 #bar {
  position: relative;
  height: 200px;
  width: 600px;
  background: linear-gradient(to left, yellow 99.9%, blue 99.9%), radial-gradient(circle at 50% 50%, yellow 50%, transparent 10%);
  background-position: 50% 100px, 50% 50%;  
  background-size:100% 15px, 100px 100px; 
  background-repeat: no-repeat, repeat-x;
}
<div id="bar"></div>

最佳答案

移除repeat-x

#bar {
  position: relative;
  height: 200px;
  width: 600px;
  background: linear-gradient(to left, yellow 99.9%, blue 99.9%), radial-gradient(circle at 50% 50%, yellow 50%, transparent 10%);
  background-position: 50% 100px, 50% 50%;  
  background-size:100% 15px, 100px 100px; 
  background-repeat: no-repeat;
}
<div id="bar"></div>

关于css - 中心只需要一个圆圈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41913550/

相关文章:

html - 如何在保持 Angular 不变的情况下创建响应式线性渐变?

python - 放置具有可变密度的点

html - 如何将多个 css 径向渐变应用于单个元素

CSS 径向渐变作为模态叠加背景,如 Apple 的

javascript - 从指令获取元素样式 - 随机失败

html - 图像助手不需要的调整大小

javascript - 在子元素上应用悬停效果

css - css 中的硬边渐变?

html - 奇怪的渐变边框效果

CSS 文本方向 : vertically oriented to the right