Both margins and outline are used to add space around the border.
An outline is a line that is drawn around elements, outside the borders, to make the element "stand out".
In CSS, a margin is the space around an element's border, while padding is the space between an element's border and the element's content. Put another way, the margin property controls the space outside an element, and the padding property controls the space inside an element.
Outline is a line outside of the element's border. Unlike other areas of the box, outlines don't take up space, so they don't affect the layout of the document in any way.
In HTML margins work the same way in giving space away from the edge of the page. Borders simply wrap the element. A border can wrap immediately around an element, or it may look further away from an element if more padding has been applied to the element. Padding provides space around the element.
outline
is just drawing an line around the border, without actually claiming space.
Here is a JSFiddle demonstrating both: http://jsfiddle.net/g8FXT/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With