Equal width columns in CSS Grid

后端 未结 7 1117
别跟我提以往
别跟我提以往 2020-12-25 10:27

I\'d like to have the html below showing in n equal columns whether there are two, or three, or more child elements to the row element using css grid - Flexbox makes this ea

相关标签:
7条回答
  • 2020-12-25 11:13

    None of these answers worked for me, So I tried another way. In my case, item size is related to the content. Some contents are bigger than others, so all columns will not be equal. I just wrapped any item with another division that has 100% width and 100% height and that is working.

    <div class="row">
        <div style="width: 100%; height: 100%;">
          <div class="item"></div>
        </div>
        <div style="width: 100%; height: 100%;">
          <div class="item"></div>
        </div>
        <div style="width: 100%; height: 100%;">
          <div class="item"></div>
        </div>
    </div>
    

    That is worked for me and I hope to help you.

    0 讨论(0)
提交回复
热议问题