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

后端 未结 10 638
深忆病人
深忆病人 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:26

    An easier way to get the same effect is to let the content inside your columns create your gutters rather than applying margins/padding to the columns themselves. This can be done with fixed, fluid, elastic, etc. grids.

    For example:

    /* Gutters */
    h1, h2, h3, h4, h5, h6,
    p, ul, ol, blockquote,
    hr, address, pre, object, fieldset
    {
        margin-right: .75rem;
        margin-left: .75rem;
        padding-right: .75rem;
        padding-left: .75rem;
    }
    

    This also simplifies sizing your columns, nesting, and applying backgrounds to your lego pieces.

提交回复
热议问题