Samar Yadav Samar Yadav - 1 month ago 9
CSS Question

Add margin on both sides of free space(background) in Html - css page

I am trying to add margin on both sides of free space in Html. and fill background in the middle remaining part only.

But this id doesn't work when i put it in body tag.

#bodyid{
display: block;
margin-left: 100px;
margin-right: 100px;
background-color: #E3EAEA;
}


above given colors are random. Result should be like this.

capture[![this should be the result]1

Thanks for helping.

Answer

Just make body white and add a container div. Like here: https://jsfiddle.net/p1mz721k/