Hello guys, please help, i’m new to website
the img just doesn’t fit anymore from width less than 440
i try it in chrome dev tools
source : https://tinyurl.com/y657oq5s
There’s not enough information for us to reproduce your problem I’m afraid.
It would seem that you have set a fixed height for the container or some other method not shown in the code you have supplied. Please provide a working example or link that shows us the problem you are encountering.
You can’t make an image arbitrarily fit any height or width you throw at it and still have it maintains its aspect ratio without the image either being squashed, stretched or cropped in some way (unless by accident or design the container is exactly the same aspect ratio as the image).
Usually you let the width of the image fill its container and its height will remain auto so that aspect ratio is maintained.
Looking at the third image that you posted its obvious that it can’t automatically fill that white space and still maintain its aspect ratio because it would be stretched tall. The only option if you want to maintain that fixed height is to use object-fit:cover on the image and set its width and height to 100%. This will only work in modern browsers (not IE) (background-size:cover does the same thing for background images and has more browser support).
Looking at your pictures surely it would be better not to fix the height of that section and then there’s no problem. You don;t really want a really tall height on a narrow screen anyway.
However, as I said above we really need to see a demo of the problem at hand as the above comments are just best guesses
OK I looked at your zip and the problem has nothing at all to do with the image as that is working as best it can.
The white-space is caused by your nav dropping down to the next line and so on as it gets smaller. You can see this clearly in your screenshots where the nav displays less and less menu items
The reason you don’t see the white text of the nav is because white text on a white background is invisible. You set a min-height of 50px for your header but that is bad move because that was not based on its content but just a magic number guess and will be incorrect for different screensizes.
You need to make the header automatically contain its floated children and then the black background will be seen around the white text. Add overflow:hidden to .nav ul{overflow:hidden} and that will contain the floated list items (although these days you should be using flex rather than floats).
For smaller screens you should be adding a media query at the point where the menu wraps and create a better display for small screen rather than just wrapping text (either a hamburger menu or just items at full width).
As this is a school project I will leave you to work out the details now that you know what the problem is
Hi,
You are using the image tag in html code, from html you can only manage image width, So if you want the proper result then, you have to use CSS properties for image, First Set the image as background & rest of the properties are mentioned below -
I have already answered this question and it has nothing to do with the image tag as such.
Please read the thread in full before answering to make sure you are addressing the correct problem. Your suggestion would not have helped in this situation as the problem was with the nav and not the image as such.