so I have this code
<div class="contentBlock">
<div id="profileBlock">
<div id="imageContainer"></div>
<div id="textBlock">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
css
.contentBlock
{
display: inline-block;
width: 100%;
height: 100%;
}
#profileBlock
{
text-align: center;
margin: 25px 25px;
height: 350px;
}
#textBlock
{
width: 50%;
display: inline-block;
margin: 0px 25px;
}
#imageContainer
{
vertical-align: top;
display: inline-block;
width: 250px;
height: 300px;
background-image: url('http://placehold.it/250x300');
background-repeat: no-repeat;
}
https://jsfiddle.net/h21f2882/
It's basically a section of my portfolio website. I'm trying to have the placeholder picture positioned next to my text. However when I resize my browser the text goes underneath the picture, which is not the problem I'm trying to address. The problem is however that the container does not scale. Allowing the entire textBlock
div to overflow it's boundaries.
Now I have two questions:
If I would make a media query where I would change the display back into block and resize the
profileBlock
to X pixels. Would this be bad practice as I would be using a magic number to set the height?How could I change the height of this container to fit it's children after this occurrence?
Thanks in forward Max Beekmans