CSS margin and padding code example
Example 1: css margin bottom
.yourClass {
margin-bottom: 25px;
}
Example 2: margin vs padding
Margin is on the outside of block elements, padding is on the inside.
Use margin to separate the block from things outside it
Use padding to move the contents away from the edges of the block.
Main differences:
- Vertical margins of adjacent items will overlap, padding will not
- Padding is included in the click region and background color/image,
but not the margin
Example 3: css padding vs margin
Example 4: css margin
#blockOrInline-Block {margin: 0px 0px 0px 0px;}
Example 5: css box model
MDN (Mozilla Developer Network)
Probably the best place for an in-depth explanation of
web related technologies.
See the link below regarding the CSS BOX MODEL