What is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?

前端 未结 11 1341
别跟我提以往
别跟我提以往 2020-11-22 14:39

What is the difference among col-lg-* , col-md-* and col-sm-* in Twitter Bootstrap?

11条回答
  •  旧时难觅i
    2020-11-22 15:25

    The bootstrap docs do explain it, but it still took me a while to get it. It makes more sense when I explain it to myself in one of two ways:

    If you think of the columns starting out horizontally, then you can choose when you want them to stack.

    For example, if you start with columns: A B C

    You decide when should they stack to be like this:

    A

    B

    C

    If you choose col-lg, then the columns will stack when the width is < 1200px.

    If you choose col-md, then the columns will stack when the width is < 992px.

    If you choose col-sm, then the columns will stack when the width is < 768px.

    If you choose col-xs, then the columns will never stack.

    On the other hand, if you think of the columns starting out stacked, then you can choose at what point they become horizontal:

    If you choose col-sm, then the columns will become horizontal when the width is >= 768px.

    If you choose col-md, then the columns will become horizontal when the width is >= 992px.

    If you choose col-lg, then the columns will become horizontal when the width is >= 1200px.

提交回复
热议问题