只需要一个圆心

时间:2017-01-28 18:53:02

标签: css css3 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>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:2)

删除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>

答案 1 :(得分:1)

您应该删除repeat-x

 #bar {
  position: relative;
  height: 200px;
  width: 600px;
  background: #fff; //type in your color between # and ;
  background-position: 50% 100px, 50% 50%;  
  background-size:0 15px, 100px 100px; 
  background-repeat: no-repeat;
}