In my semi-fluid forums layout, I'm experiencing a strange problem where images in posts sometimes stretch the page, but sometimes they don't.
I've set the images to "max-width: 98%", expecting this to scale them down to the width of the parent element. However, this only happens sometimes; for some reason, on other occasions the images explode the layout, and I cannot tell why.
From what I can see, both pages contain huge images, but only one of them stretches the layout, while the other scales correctly.
The elements are structured using this HTML code (example):
<div class="post">
<div class="postbody">
<div class="content">
<img src="<source>" class="postimage" alt="Image">
</div>
</div>
</div>
while following the below CSS rules:
.post {
padding: 0.5rem 0.5rem 0.5rem 1rem;
margin-bottom: 1.6rem;
position: relative;
}
.postbody {
padding: 0px 0px 3rem;
width: 83%;
float: right;
}
.postbody .content {
font-family: Verdana,Arial,Helvetica,sans-serif;
overflow-x: auto;
}
.postbody img.postimage {
width: auto;
max-width: 98%;
}
A more precise view of the code can be seen at the above working examples.
I experience this issue on Firefox 30 and Internet Explorer 11 at 1920x1080, but not on Google Chrome. What's the deal? Maybe it has to do with my other issue?