How to use border with Bootstrap

后端 未结 9 758
独厮守ぢ
独厮守ぢ 2020-12-23 15:53

How can I solve this problem? When you add borders to a div, the div is not centered and the span12 class is not centered.

I would like to center the di

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 16:33

    You can't just add a border to the span because it will break the layout because of the way width is calculate: width = border + padding + width. Since the container is 940px and the span is 940px, adding 2px border (so 4px altogether) will make it look off centered. The work around is to change the width to include the 4px border (original - 4px) or have another div inside that creates the 2px border.

提交回复
热议问题