Hack Forums
CSS how to make image not dependant on its div container size - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: CSS how to make image not dependant on its div container size (/showthread.php?tid=5769865)



CSS how to make image not dependant on its div container size - Account of the Gods - Dec 17, 2017

solved

I have a div with a specified size on my wordpress theme.

What Is the problem is that My images are getting scaled from 100% to 90% automatically and i cant fix it.

They containt TEXT so its getting BLURRED, ugly! cant read it.


What I want to do is to stop images from getting scaled WITHOUT increasing the size of this div, because it contains a lot of other visual elements that will break.



How can I do that?

Im thinking of something like

img {
   width:110% !important;
}

But it doesnt work.

I believe the div is limiting it. Because image width is  dependant on div width.
But how to do it?



 nvm i used max-width:150% for image

thanks


RE: CSS how to make image not dependant on its div container size - Mr. Miyagi - Jan 15, 2018

Try creating a class that removes the width requirements of an image.

Code
img {
   max-width: none;
   min-wdith: none;
}



RE: CSS how to make image not dependant on its div container size - wikiextras - Jan 17, 2018

Use viewport height & width for responsiveness.