+ 1

<SOLVED> Why doesn't the image take 100% of the screen? How do I fix that so it always takes 100% of the screen?

I don't want any white spaces around the image, I can fix that using margin to push the image to the left and then width to fill the remaining space at the right, but the problem is, the sceeen size can change, and when it does I have problems. https://code.sololearn.com/Ww5G77Qmd9aQ/?ref=app

13th Aug 2020, 12:55 PM
Karak10
Karak10 - avatar
5 Respuestas
+ 2
Karak10 if you put the margin, and padding to 0 on body it will remove just to that.. But on * as you may know to all elements those will be removed As every element has some default margin and padding by the User agent.
13th Aug 2020, 1:08 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Vadi velan it doesn't work
13th Aug 2020, 1:01 PM
Karak10
Karak10 - avatar
0
Vadi velan nvm I put it on body and it worked
13th Aug 2020, 1:01 PM
Karak10
Karak10 - avatar
0
Мг. Кнап🌠 well, when I put it on the image alone it didn't work for some reason tho, I don't understand why when I put it for all elements or on body it works but when I do it only on image it doesn't.
13th Aug 2020, 1:19 PM
Karak10
Karak10 - avatar
0
image don't have Margin and padding as default, they just have display as inline-block property, therefore the margin: 0; and padding:0; didn't work out.. Since it is an inline-block element it will have property of both block and inline, so u can apply width height margin padding
13th Aug 2020, 1:23 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar