Adding borders to span divs in Bootstrap messes up layout

后端 未结 5 1681
遇见更好的自我
遇见更好的自我 2021-02-07 13:58

I am starting with Twitter Bootstrap and have a question about how layout functions in it. Here is the HTML:



    
         


        
5条回答
  •  梦毁少年i
    2021-02-07 14:13

    The span classes in bootstrap have specific widths so adding a border throws off the total for the row and forces them to wrap. To get around this I usually put the border styling on a div inside the div with the span class. Something like this:

    HTML

    a
    b

    CSS

    .span4 > div, .span8 > div
    {
       background-color:#eee;
       border: 1px solid #888;
       border-radius:3px;
    }
    

提交回复
热议问题