How can an element take the full width of the screen | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can an element take the full width of the screen

Whenever I make a element take 100% of the width, eg width:100% There is always some space between the edge of the screen. It looks like it's only taking 95%. How do I fix this? Is it my browser?

8th Sep 2021, 11:28 AM
Kylar Cham
6 Answers
+ 2
Put margin 0 in body tag
8th Sep 2021, 11:30 AM
A͢J
A͢J - avatar
+ 1
Thank you all. That simple thing is what's been hurting my brain for a while😂
8th Sep 2021, 11:41 AM
Kylar Cham
+ 1
Consider adding *{ margin: 0; padding: 0; box-sizing: 0; } in all your CSS files.
8th Sep 2021, 11:48 AM
Kashyap Kumar
Kashyap Kumar - avatar
0
Thank you
8th Sep 2021, 11:30 AM
Kylar Cham
8th Sep 2021, 11:36 AM
A͢J
A͢J - avatar
0
I've never seen the property "box-sizing"
8th Sep 2021, 11:49 AM
Kylar Cham