Nice video. Even if you don't apply the size of the div, with the img {max-width: 100%;} is good enough for the image to be fluid or resize depending on the size of the window or device width.
Thanks you so much but if you don't mind I want learn about logic behind this I mean why not with just height and width why after applying percentage it start working??? Why
So max-width means the maximum width it can be is 100%. So if an image is 500px wide, and the screen is 1000px then the image will be 500px wide. But if the screen is 450px, then the image will be 450px as well, as the maximum width it can be is 100%. This will be same for max-height.
Take into account that according to Google Lighthouse your images should already be the correct size to be displayed. Adjusting the size client side will result in points being deducted.
it doesnt work. I want to make it a background image thats 700px of height and a width of 100% but when i copied ur vid my image didnt display 100% of its width
sir let we have to take image height 500px but image height not more than 200px how to solve it with out using min-width in div and image please tell sir i m new in this field
Try to use as background Image. Following is a 200px image and I called it as background image. Explore more about background-size with cover, 100%, 100vw 100vh.
Thankyou very very much i spend an hour to do this before watching your video.
Welcome!
Thank you so much, I always used to struggle and spent some time to discover what is really the best solution to this image problem 😄
Glad it helped!
That 'max width' thing helped me a lot thank you so much!!!!!
Thank You!
Nice video. Even if you don't apply the size of the div, with the img {max-width: 100%;} is good enough for the image to be fluid or resize depending on the size of the window or device width.
Good point!
short and straight to the point, thank you
Thank You!
Thank you, i was stressing out.
You are welcome!
thank you! this is really helpful
Thanks so much
thanks g you clutched up
Always
Very very much thank u 😊
Welcome!
thank you sir ...its help me more ....thank u very very much🥰🥰
Welcome!
god bless you thank you soooooooooooooo muchhhhh
You Welcome 🙂
SHORT AND SWEET ♥️
Thank You!
Thanks it's really useful for me
Welcome 😊
thank you
You're welcome
Thank you bro
Welcome
Thanks you so much but if you don't mind I want learn about logic behind this I mean why not with just height and width why after applying percentage it start working??? Why
So max-width means the maximum width it can be is 100%. So if an image is 500px wide, and the screen is 1000px then the image will be 500px wide. But if the screen is 450px, then the image will be 450px as well, as the maximum width it can be is 100%. This will be same for max-height.
@@webmastercampus 😊☺️
thanks man u r grt...
So nice of you
Nice! Although, I'm trying to round the photo now with border-radius but it doesn't seem responsive. Anybody have a solution?
What if we set the width of div 100%?
Thank you so much
You're most welcome
Take into account that according to Google Lighthouse your images should already be the correct size to be displayed. Adjusting the size client side will result in points being deducted.
You are right but I was explaining the concept without taking img size into consideration. May be I will create a new video with detail explanation.
Can you make a resizable rectangle in css and it should at the same time display the size in inches
Let me know please
Thanks
thank you so muchhh
You're welcome!
Code URL: www.webmastercampus.com/css-auto-resize-an-image-inside-a-div-container/
it doesnt work. I want to make it a background image thats 700px of height and a width of 100% but when i copied ur vid my image didnt display 100% of its width
tahnk you your a saviour just sub!
Welcome
thanks a lot
You are most welcome
thanks man
Happy to help.
Thankyou
Welcome!
thanks for thiiis! awesome 😇
You're welcome 😊
sir let we have to take image height 500px but image height not more than 200px how to solve it with out using min-width in div and image please tell sir i m new in this field
Try to use as background Image. Following is a 200px image and I called it as background image. Explore more about background-size with cover, 100%, 100vw 100vh.
.bannerImage {
width: 500px;
height: 300px;
border: 1px solid black;
background: url(images.unsplash.com/photo-1518259102261-b40117eabbc9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=200&q=80) no-repeat;
background-size: 100%;
}
Thank youuuuuu❤❤❤
Welcome
Wow
Thank You!
Thank you 😭
You're so welcome!
It didn't work how come :( ?
Paste your code in comment or share github link and I will try to help you.
Great, short video! your explanation was clear and easy to follow (:
Glad it was helpful!
I can't understand your accent
Turn on the subtitles bro
thank you
Welcome!
thank you