How do I create a circle or square with just CSS - with a hollow center?

后端 未结 8 2587
南旧
南旧 2020-12-13 08:47

It should just basically be an outline of the square or circle - that I can style accordingly (i.e. change the color to whatever I want, change the thickness of the border,

8条回答
  •  [愿得一人]
    2020-12-13 09:25

    If you want your div to keep it's circular shape even if you change its width/height (using js for instance) set the radius to 50%. Example: css:

    .circle {
        border-radius: 50%/50%; 
        width: 50px;
        height: 50px;
        background: black;
    }
    

    html:

提交回复
热议问题