CSS Auto Resize an Image Inside a Div Container

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 75

  • @drgblade9390
    @drgblade9390 5 місяців тому +8

    Thankyou very very much i spend an hour to do this before watching your video.

  • @davi48596
    @davi48596 7 місяців тому +5

    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 😄

  • @NaranjaNad
    @NaranjaNad Рік тому +3

    That 'max width' thing helped me a lot thank you so much!!!!!

  • @mrsilvadecals
    @mrsilvadecals Рік тому +7

    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.

  • @stmobile453
    @stmobile453 Рік тому +1

    short and straight to the point, thank you

  • @OO-ll8hi
    @OO-ll8hi Рік тому +1

    Thank you, i was stressing out.

  • @mdfamacion9513
    @mdfamacion9513 Місяць тому

    thank you! this is really helpful

  • @MsAlexis
    @MsAlexis 26 днів тому

    Thanks so much

  • @rizzgod36
    @rizzgod36 8 місяців тому +1

    thanks g you clutched up

  • @clashfamily8614
    @clashfamily8614 5 місяців тому +1

    Very very much thank u 😊

  • @yourchoice4162
    @yourchoice4162 4 місяці тому

    thank you sir ...its help me more ....thank u very very much🥰🥰

  • @prasiddhabhattarai3411
    @prasiddhabhattarai3411 2 роки тому +3

    god bless you thank you soooooooooooooo muchhhhh

  • @SmilingHidingCat-ir6dg
    @SmilingHidingCat-ir6dg 7 місяців тому +1

    SHORT AND SWEET ♥️

  • @Abcd-coding
    @Abcd-coding 10 місяців тому

    Thanks it's really useful for me

  • @ionutfelicitari9328
    @ionutfelicitari9328 8 місяців тому +1

    thank you

  • @adeosunadeyanju1549
    @adeosunadeyanju1549 4 місяці тому

    Thank you bro

  • @AkiHan.12_369
    @AkiHan.12_369 7 місяців тому +1

    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

    • @webmastercampus
      @webmastercampus  6 місяців тому

      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.

    • @AkiHan.12_369
      @AkiHan.12_369 6 місяців тому

      @@webmastercampus 😊☺️

  • @atul6224
    @atul6224 8 місяців тому +1

    thanks man u r grt...

  • @UnderscoreGoblin
    @UnderscoreGoblin 11 місяців тому

    Nice! Although, I'm trying to round the photo now with border-radius but it doesn't seem responsive. Anybody have a solution?

  • @muhammadikram139
    @muhammadikram139 2 роки тому +1

    What if we set the width of div 100%?

  • @davidnnacheta
    @davidnnacheta Рік тому

    Thank you so much

  • @m12652
    @m12652 Рік тому

    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.

    • @webmastercampus
      @webmastercampus  Рік тому +2

      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.

  • @kazim1954
    @kazim1954 Рік тому

    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

  • @drttbag
    @drttbag Рік тому

    thank you so muchhh

  • @webmastercampus
    @webmastercampus  2 роки тому +1

    Code URL: www.webmastercampus.com/css-auto-resize-an-image-inside-a-div-container/

  • @mazuki7602
    @mazuki7602 4 місяці тому

    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

  • @TheMatter-xd1ts
    @TheMatter-xd1ts Рік тому

    tahnk you your a saviour just sub!

  • @zayed1747
    @zayed1747 Рік тому

    thanks a lot

  • @sajidhakeem8180
    @sajidhakeem8180 Рік тому

    thanks man

  • @shreyabajpai6247
    @shreyabajpai6247 2 роки тому

    Thankyou

  • @ajalimagno4542
    @ajalimagno4542 2 роки тому

    thanks for thiiis! awesome 😇

  • @deepaksinghlodhi123
    @deepaksinghlodhi123 Рік тому

    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

    • @webmastercampus
      @webmastercampus  Рік тому +1

      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%;
      }

  • @kumudstar7339
    @kumudstar7339 Рік тому

    Thank youuuuuu❤❤❤

  • @nemeconcept
    @nemeconcept 2 роки тому

    Wow

  • @nnamdiallen
    @nnamdiallen Рік тому

    Thank you 😭

  • @CloverFieldKingdom
    @CloverFieldKingdom Рік тому

    It didn't work how come :( ?

    • @webmastercampus
      @webmastercampus  Рік тому

      Paste your code in comment or share github link and I will try to help you.

  • @billisbro158
    @billisbro158 Рік тому

    Great, short video! your explanation was clear and easy to follow (:

  • @FastEnglish4u
    @FastEnglish4u 8 місяців тому

    I can't understand your accent

  • @brightasinde7034
    @brightasinde7034 8 місяців тому +1

    thank you

  • @TheSamwise61
    @TheSamwise61 19 днів тому

    thank you