Responsive CSS Circles

后端 未结 4 1354
挽巷
挽巷 2020-11-30 04:00

Goal:

Responsive CSS circles that:

  1. Scale with equal radius.
  2. Radius can be calculated by percent.
  3. Radius can be con
4条回答
  •  囚心锁ツ
    2020-11-30 04:47

    You don't need @media queries for this. This is my try, pure CSS:

    .x1 {
        overflow:hidden;
    }
    .x1 .x2 {
        display:block;
        float:left;
        padding: 12.5%;
        width:auto;
        height:auto;
        border-radius:50%;
        -moz-border-radius:50%;
        -webkit-border-radius:50%;
        -khtml-border-radius: 50%;
        background:#eee;
        text-align:center;
        position: relative;
    }
    .x1 .x2 span {
        position: absolute;
        width: 100%;
        left: 0;
        top: 48%;
        line-height: 1em;
        height: 1em;
        font-size: 100%;
        overflow: hidden;
    }​
    

    Fiddle

    Full Screen

提交回复
热议问题