Distribute elements evenly using CSS

后端 未结 13 824
一生所求
一生所求 2020-12-09 02:55

A method to distribute elements evenly in a container using CSS appeared on Smashing Magazine today.

I recently had to use Javascript to achieve the same effect for

13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 03:20

    Trevor Dixon's improved variant (without extra

  • )

    HTML

    
    

    CSS

    ul {
        margin: 0;
        padding: 0;
    }
    ul li {
        display: inline-block;
        text-align: justify;
    }
    ul:after{
        display: inline-block;
        content: '';
        width: 100%;
        height: 0;
    }
    

提交回复
热议问题