0

I've set my div element to have some css rules. It has a width and height of 100px. It also has its padding, border, and margin set to 0px. What CSS default tells the code to offset the elements around 10px from the edges of the browser window? I know that my css styles are working because the division directly below the first one is touching it because of the zero margin.

enter image description here

WSBT
  • 33,033
  • 18
  • 128
  • 133

2 Answers2

1

Add this at the top of your stylesheet:

body {
  margin:0px;
  padding:0px;
} 

the body has some default padding and margin setting that to 0 will make the elements stick to the edges

Antonio Smoljan
  • 2,187
  • 1
  • 12
  • 11
0

Tip: you can always check with a element inspector

Chrome developers kit

If you press f12 you can see it's element inspector. The gray parts of the inspector shows you which default styles are enabled.

The body always has a margin of 8px by default. To disable it just use:

body{
   margin: 0px;
}
Tom Groot
  • 1,160
  • 1
  • 9
  • 26