I have absolute positioned image (on the left) with some div's positioned relative in it. On the right side I have div positioned by float: right. Is there any way to resize image when it touches floated div? Not the edge of the browser. For now I made something like this
@media screen and (max-width: 1860px){ .content-image img { max-width: 1250px; } }
@media screen and (max-width: 1780px){ .content-image img { max-width: 1200px; } }
@media screen and (max-width: 1710px){ .content-image img { max-width: 1150px; } }
@media screen and (max-width: 1640px){ .content-image img { max-width: 1100px; } }
@media screen and (max-width: 1570px){ .content-image img { max-width: 1050px; } }
@media screen and (max-width: 1500px){ .content-image img { max-width: 1000px; } }
@media screen and (max-width: 1430px){ .content-image img { max-width: 950px; } }
@media screen and (max-width: 1360px){ .content-image img { max-width: 900px; } }
@media screen and (max-width: 1290px){ .content-image img { max-width: 850px; } }
@media screen and (max-width: 1220px){ .content-image img { max-width: 800px; } }
@media screen and (max-width: 1150px){ .content-image img { max-width: 750px; } }
@media screen and (max-width: 1080px){ .content-image img { max-width: 700px; } }
@media screen and (max-width: 1010px){ .content-image img { max-width: 650px; } }
but maybe there is more cleaner way? And maybe more simplier?
Put the image in a div. For the CSS, use the following:
#image-container {
margin-right: 20%;
position: absolute;
}
#right-div {
float: right;
width: 20%;
}
.content-image {
max-width: 100%;
}