CSS fluid columns, fixed margins; the holy grail of holy grails

后端 未结 10 639
深忆病人
深忆病人 2020-12-12 10:56

Update & Summary

I feel obligated to make this question clearer, now that there is a bounty attached.

(Also, I\'m pretty sure this will be child\'s

10条回答
  •  抹茶落季
    2020-12-12 11:41

    If you can live with another nested div per column you could define the desired margin for each. To get rid of the margin on the left and right outer edges you can define a negative margin on the outer container.

    E.g.: Using pureCSS pure-g is the outer container, pure-u-* is a column node (display: inline-block) containing the nested div. spacing is the name of this custom extension of the pureCSS grid system to allow column margins.

    .pure-g.spacing {
        margin: 0 -10px;
    }
    
    .pure-g.spacing [class *= "pure-u"] > div {
        margin: 10px;
    }
    

    Should work on most browsers. Tell me if it doesn't - I am using it already.

    regards, Max

提交回复
热议问题