I make a site with a side menu. 30% of the screen is the menu, and the rest is the content.
The contents of the div, I put the background image using the COVER method. I used the first example:
https://css-tricks.com/examples/FullPageBackgroundImage/css-1.php
However, this method works great when the image occupies the entire background. As in my example, I want the same to occupy 70% of the width, "eat" the corners of the image.
How can i fix this?
HTML:
<div id="esquerda" style="width: 30%; height: 500px">
....conteudo.....
</div>
<div id="direita" style="width: 70%; height: 500px">
<img src="fundo.jpg" class="bg">
</div>
CSS
.bg {
min-height: 100%;
min-width: 1024px;
width: 100%;
height: auto;
position: fixed;
top: 0;
float: right;
}
@media screen and (max-width: 1024px){
.bg {
left: 50%;
margin-left: -512px;
}
}
source
share