+ 1

Responsive image

Hello I have a problem with a image that is responsive. The image is my header and background and after changing the height of it some part of the image has hide in mobile mode. But in pc everything is ok. What's the problem?

25th May 2021, 5:42 PM
Fram
Fram - avatar
13 Respostas
+ 1
this will work. Try using a PC to practice and experiment with developer tools in browser. It will help you a lot. .box1{ padding:0; margin:auto; } .row{ height:250px; width: 100%; background-image: url("https://s18.picofile.com/file/8434664176/aboutus_org.jpg"); background-size: cover; margin: 50px 0 0; background-position: center }
26th May 2021, 5:09 AM
Aravind Shetty
Aravind Shetty - avatar
+ 3
did you use the background-size property? https://developer.mozilla.org/en-US/docs/Web/CSS/background-size there are two useful keyword values: 'contain' and 'cover'
25th May 2021, 5:49 PM
visph
visph - avatar
+ 2
FRam Problem is that Mobile screen size is different, PC screen size is different so you have make responsive. How to make responsive, you can learn here https://www.sololearn.com/post/455766/?ref=app
25th May 2021, 5:48 PM
AÍąJ
AÍąJ - avatar
+ 2
'cover' crop the image to cover entirely the element zone. 'contain' fit the whole image to be entirely showed in the element zone. the downside of the second, is that you must choose between repeating the image to cover all the zone (default) or no repeat, but letting either showing background-color or nothing (what is under/parent)... by using background-repeat: https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat
25th May 2021, 5:58 PM
visph
visph - avatar
+ 1
*Only for Image* Use max-width or max-height properties in css. So that the image doesn't cross that limit. Even if it is a bigger image it will get scaled to that limit.
25th May 2021, 5:51 PM
Aravind Shetty
Aravind Shetty - avatar
+ 1
Aravind Shetty How is its syntax? Au usual width or height?
25th May 2021, 5:53 PM
Fram
Fram - avatar
+ 1
img{ max-width: value; }
25th May 2021, 5:54 PM
Aravind Shetty
Aravind Shetty - avatar
+ 1
relative paths don't work with code playground: you must provide absolute one (image stored on cloud)
25th May 2021, 6:01 PM
visph
visph - avatar
25th May 2021, 6:08 PM
Fram
Fram - avatar
+ 1
FRam sorry, your image is valid but is not displayed on my phone :( even your .row class element seems to not be displayed (background-color nor outline seems to NOT work in the css) have you tested your code from the playground link you provided? I can't help further, all the more that I'm not aware of bootstrap ;P
25th May 2021, 6:18 PM
visph
visph - avatar
+ 1
visph Ok thank you🙏
25th May 2021, 6:28 PM
Fram
Fram - avatar
+ 1
Aravind Shetty Yes it works😍 Thanks for your help🙏
26th May 2021, 5:46 AM
Fram
Fram - avatar
0
visph I used cover element but didn't work
25th May 2021, 6:01 PM
Fram
Fram - avatar