javascript - CSS display inline-block and fill all spaces with elements -


i have elements display:inline-block, , these's 1 elements that's bigger rest causing space between elements, in picture.

here's fiddle example.

http://jsfiddle.net/uu64hyed/

note: expand result window width see full problem.

css

.calendermonth_header {     height:35px;     line-height:35px;     text-align:center;     background-color: rgba(221,221,221,1);     border-bottom: 1px solid rgba(221,221,221,1); } .calendermonth {     height: 160px;     width:160px;     margin:10px;     border-radius:2px;     background-color: rgba(238,238,238,1);     border: 1px solid rgba(221,221,221,1);     display:inline-block;     vertical-align:top;     cursor:pointer; } .activemonth { height:340px; width:340px;} .calendermonth:hover { border: rgba(0,153,204,1) 1px solid} 

js

$(document).ready(function(e) {     var months = [      {month:'january', state:''},     {month:'feburary', state:''},     {month:'march', state:''},     {month:'april', state:''},     {month:'december', state:''}];     $(months).each(function(index, element){         element.state == 'current' ?         activemonth = 'activemonth':activemonth = '';         $('.monthsholder').append('<article class="calendermonth '+activemonth+'">\         <header class="calendermonth_header">'+element.month+'</header>\         </article>');     }); }); 

html

<section class="app_section app_section_calender hide center">   <header class="app_section_header">calender   <section class="monthsholder"  align="center"></section> </section> 

how make smaller boxes fill remaining spaces?

add float: left activemonth class :

.activemonth {   float: left;   height: 340px;   width: 340px; } 

jsfiddle: http://jsfiddle.net/ghorg12110/uu64hyed/2/


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -