html - (bootstrap) Keeping a bit of vertical space between elements when they wrap? -


using bootstrap, when i'm putting bunch of elements (e.g. buttons) in row , shrink window, elements wrap around.

but while there horizontal space between elements when window wide enough contain next eachother, vertically gets stuck together, 0 pixels of empty space between.

live example (narrow or widen output window see effect)

screenshot example:
1. wide enough, notice space between buttons
2. wrapping around, notice no space between buttons stacked on top of eachother

i guess mess around custom css, adding vertical margins or whatnot, in order keep things compatible , standard possible, wonder if there better or more native way fix in bootstrap layout?

what happens here buttons displayed inline block , default such elements have no white space or margin begin with. can use below method avoid this.

what have done added class parent element of buttons , inherit style class "btn".

html

<div class='container'>     <div class='row'>         <div class='col-xs-12 button-wrapper'>             <button class='btn btn-primary'>lorem ipsum dolor sit amet</button>             <button class='btn btn-info'>consectetur adipiscing elit</button>             <button class='btn btn-success'>sed eiusmod tempor incididunt</button>         </div>     </div> </div> 

css

.button-wrapper .btn {     margin-bottom:5px; } 

demo


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -