In a bootstrap responsive page how to center a div

前端 未结 16 2256
长情又很酷
长情又很酷 2020-12-02 04:26

\"position

I need to create a responsive page using bootstrap by positio

16条回答
  •  攒了一身酷
    2020-12-02 05:10

    I think the simplest way to accomplish the layout with bootstrap is like this:

    Content goes here

    all I did was to add layers of divs that allowed me to center the div, but since I am not using percentages, you need to specify the max-width of the div to be center.

    You can use this same method to center more than one column, you just need to add more div layers:

    Some content

    More content

    Note: that I added a div with column 12 for md, sm and xs, if you don't do this the first div with background color (in this case "blueviolet") will collapse, you will be able to see the child divs, but not the background color.

提交回复
热议问题