I am trying to create a tumblr theme using a masonry grid layout. I want all the posts (.entry) to be 25% of the width of the page. However, the sidebar is not being taken into account when loading the images. The images always end up spilling over the side of the page by 17px, the same width of the scrollbar in my browser.
I tried to remedy this by setting the scrollbar to 5px and setting the container of the the posts (#content) to (100% - 5px). This worked great in Chrome but not in all browsers.
I do not want to hide the scrollbar. I am sure that the issue is due to masonry, as positioning 4 divs at 25% width outside of the masonry container works fine.
The full code can be seen here. The theme can be viewed here. Relevant code below:
Masonry Code
$(function(){
var $container = $('#content');
$container.imagesLoaded(function() {
$container.masonry({
itemSelector: '.entry',
columnWidth: '.grid-sizer',
percentPosition: true,
isAnimated:true,
columnWidth:1,
animationOptions:{duration:350, queue:false},
isFitWidth: false,
});
});
CSS
#content{
position: relative;
text-align: center;
width: 100%;
height: 100%;}
body {
margin: 0;
font-family: {font:Main Text};
font-weight:400;
font-size: 11px;
line-height: 18px;
color:{color:Post Text};
text-align: left;
min-height: 110vh;
word-wrap: break-word;
background-color: {color:Background};
width: 100%;}
.entry{
background-color:{color:Post Background};
text-align: left;
position: relative;
overflow: hidden;
width: calc((100%) / 4);
margin:0;
padding:0;
border:0;
float: right;}
.grid-sizer{width: calc(100% / 4);}