Well, on the margin between the div’s, just change the CSS
on your page, changing the margin.
.col-md-3{
margin: 0 5px 5px 0;
}
Regarding the size, I believe you do not know the size of each text to define the min-heigth
of the page, then I advise using jQuery
to get the biggest size of each div
and set the heigth
equal for all.
It would look something like this:
$(document).ready(function() {
var maxHeight = -1;
$('.col-md-3').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$('.col-md-3').each(function() {
$(this).height(maxHeight);
});
});
See an example on Jsfiddle.
References: Use jQuery/CSS to find the tallest of all Elements.
If you want to change the size by blocks, you can separate the value from the maxHeigth
in each block, this way:
$(document).ready(function() {
var maxHeight = -1;
$('.row').each(function() {
$(this).find('.col-md-3').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$(this).find('.col-md-3').each(function() {
$(this).height(maxHeight);
});
});
});
Functional example in Jsfiddle.
I don’t quite understand how you want this organization. I could explain better?
– Randrade
I’m sorry for the confusion, but you can see in the image that the Divs are disorganized, I wanted something aligned higher, without this blank space on the left side (for example). @Randrade
– Lucas
So, there are sites that seek this "disorganization" of sizes as a layout requirement. In your case, do you want it to stick to each other and to a fixed size? And the text, has trouble cutting or will add a blank space in those that do not have enough text?
– Randrade
Yes, I have seen these 'disorganized' layouts, but in this case, I imagine, it is better to maintain a more severe organization, (due to the target audience and other issues). Thus, I planned to keep the images and titles aligned, and if there were spaces below between one product and another would be better than product spaces "missing" as is happening. @Randrade
– Lucas