简体   繁体   中英

Make image resize when user resizes layout

I don't want anything '100%' to fit the parent div. The image might be a tiny square inside the div or a huge square inside the div. What I want is for the dimensions to be respected whenever the user scales the page. I tried with percentages but the image always seemed somewhat displaced despite the mathematical logic:

div 100% --- div dimensions in px image X --- image dimensions in px

So I'm wondering if there is another way of keeping the image to resize while resize:both also does not work. Does anyone know how to do this? (tagging javascript because I can use it if needed)

U could add some table or div where is your image with attribute Width (width="99%") and let it go :)

Advanced help: Link , good luck !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM