CSS Margins

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • margin: <top & right & bottom & left>;
  • margin: <top>, <left & right>, <bottom>;
  • margin: <top & bottom>, <left & right>;
  • margin: <top>, <right>, <bottom>, <left>;
  • margin-top: <top>;
  • margin-right: <right>;
  • margin-bottom: <bottom>;
  • margin-left: <left>;

Parameters

ParameterDetails
0set margin to none
autoused for centering, by evenly setting values on each side
units (e.g. px)see parameter section in Units for a list of valid units
inheritinherit margin value from parent element
initialrestore to initial value

Remarks

More on "Collapsing Margins": here.



Got any CSS Question?