How to make one circle inside of another using CSS

后端 未结 13 2182
-上瘾入骨i
-上瘾入骨i 2020-12-30 03:54

I am trying to make one circle inside of another circle using css, but I am having an issue making it completely centered. I am close, but still not there. Any ideas?

<
13条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-30 04:21

    Solved this by using CSS transform property:

    You can refer to this JS fiddle link for below output: http://jsfiddle.net/suprabhasupi/74b1ptne/

    div {
      border-radius: 50%;
      /* border: 1px solid red; */
    }
    
    .circle1 {
      position: relative;
      width: 300px;
      height: 300px;
      background-color: red;
    }
    
    .circle2 {
      transform: translate(25%, 25%);
      width: 200px;
      height: 200px;
      background-color: green;
    }
    
    .circle3 {
       transform: translate(48%, 46%);
      width: 100px;
      height: 100px;
      background-color: blue;
    }

提交回复
热议问题