Patric Nøis Patric Nøis - 1 year ago 164
CSS Question

Div background image max size

I have some problems with setting the max height of a background image in a

. The max height should be the height of the image and not larger than that. It's just zooming in on the image if there's to much content in the
. When the background image ends I want it to continue with a background color for the rest of my content. Here is the code I've tried

.profilbg {
background: url(<?php echo $uin->backgroundimg; ?>);
background-repeat: no-repeat;
.profilen {
width: 100%;
text-align: left;
clear: both;
<div class="profilen">
<div class="profilbg">
<?php echo nl2br($uin->profilen); ?>

With this code the background image is just zooming in and getting bigger if there's to much content.

Answer Source

I know this alreay is solved but it would be easy to do whit background-size: 100%; As you are using cover it will cover the Whole page but if you use 100% it will cover the page whit the background whitout geting zoomed inn

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download