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

后端 未结 8 2593
南旧
南旧 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:09

    Circle Time! :) Easy way of making a circle with a hollow center : use border-radius, give the element a border and no background so you can see through it :

    div {
        display: inline-block;
        margin-left: 5px;
        height: 100px;
        border-radius: 100%;
        width:100px;
        border:solid black 2px;
    }
    
    body{
        background:url('http://lorempixel.com/output/people-q-c-640-480-1.jpg');
        background-size:cover;
    }

提交回复
热议问题