CSS circles without width or height? : Is this possible with pure CSS or not?

后端 未结 4 1357
清酒与你
清酒与你 2021-01-02 02:48

I can turn a div into a circle like this:

.circle {
 background-color: rgba(0, 0139, 0139, 0.5);
 height: 200px;
 width: 200px;
 -moz-border-radius:50%;
 -we         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-02 03:14

    All you need to do is replace you height and width with a padding and display inline-block. Reference: http://jsfiddle.net/6mzP7/

    .circle {
       background-color: rgba(0, 0139, 0139, 0.5);
       padding: 200px;
       display: inline-block;
       -moz-border-radius:50%;
       -webkit-border-radius: 50%;
       border-radius:50%; 
    }
    
    ​

    The HTML can stay the same.

提交回复
热议问题