In this code how to remove the white boundary around the div element? Means I want to cover full space with a colour. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

In this code how to remove the white boundary around the div element? Means I want to cover full space with a colour.

link--https://code.sololearn.com/WwopKswZN0E2/?ref=app please help.. Thanks....

6th Nov 2017, 11:45 AM
Jitesh Gupta
6 Answers
+ 8
that's the correct solution: HTML: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <div>Hello</div> </body> </html> -------------------- CSS: body { margin:0; } div{ background-color:red; height:300px; }
6th Nov 2017, 12:25 PM
Kamil
Kamil - avatar
+ 7
body{ margin:0; } Every element of html has default css propertied so you can reset them, in this case you can set margin:0 to all elements: *{ margin:0; }
6th Nov 2017, 11:49 AM
ThreeG
ThreeG - avatar
+ 2
use this <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body><!--by ThreeG--> <h1>welcome guys</h1> </body> </html> body { background:red; }
6th Nov 2017, 12:16 PM
Franklyn Omeben
Franklyn Omeben - avatar
+ 2
thanks Kamil it was exactly what i want
6th Nov 2017, 12:45 PM
Jitesh Gupta
0
thank you @ThreeG but this code is working only for side margins, what about top?
6th Nov 2017, 11:51 AM
Jitesh Gupta
0
but i don't want to fix it
6th Nov 2017, 12:02 PM
Jitesh Gupta