Looking to create a visually appealing page that always fills the entire screen? Check out this code snippet that does just that:
#posts{
width:100%;
height:auto;
background:#666;
}
.entry{
float:left;
margin-left: 4%;
margin-top:10px;
margin-bottom: 10px;
width:20%;
height:100px;
background:#000;
}
However, there seems to be an issue with resizing the window. Despite using percentages for margins and sizes, it doesn't adjust correctly on window resize. Why is that so?
So my question is:
Why do CSS percentages not resize properly when the window size changes, and how can I fix it?
Make sure to resize your window after loading the page to witness the problem firsthand.
Take a look at the jsfiddle here
UPDATE:
After receiving some feedback, it appears that the issue stems from a conflict between my layout goals and masonry's absolute positioning of elements. To address this, I need a JavaScript/jQuery solution that can recalculate the margins based on correct percentages upon window resize. How can I achieve this?