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

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

    Shortly after finding this questions I found these examples on CSS Tricks: http://css-tricks.com/examples/ShapesOfCSS/

    Copied so you don't have to click

    .square {
      width: 100px;
      height: 100px;
      background: red;
    }
    .circle {
      width: 100px;
      height: 100px;
      background: red;
      -moz-border-radius: 50px;
      -webkit-border-radius: 50px;
      border-radius: 50px;
    }
    /* Cleaner, but slightly less support: use "50%" as value */

    There are many other shape examples in the above link, but you will have to test for browser compatibility.

提交回复
热议问题