VOOZH about

URL: https://www.geeksforgeeks.org/css/primer-css-reset-margins/

⇱ Primer CSS Reset Margins - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Primer CSS Reset Margins

Last Updated : 23 Jul, 2025

Primer CSS is an open-source component-rich CSS library that helps developers to develop beautiful and responsive websites which work on devices of any screen size. It has a wide range of components that fulfills the need of any website.

In this article, we will be seeing Primer CSS Reset Margins. The Reset Margin Classes are used to set the margins on any element to zero. The use of reset margin classes will override any default margin on the element.

Primer CSS Reset Margins Classes:

  • m-0: This class is used to reset the margin on all four sides to zero.
  • mt-0: This class is used to reset the margin on the top of the element to zero.
  • mr-0: This class is used to reset the margin on the right of the element to zero.
  • mb-0: This class is used to reset the margin on the bottom of the element to zero.
  • ml-0: This class is used to reset the margin on the left of the element to zero.
  • mx-0: This class is used to reset the horizontal margin of the element to zero.
  • my-0: This class is used to reset the vertical margin of the element to zero.

Syntax:

<div class="mt-0"> ... </div>

Example 1: The example below shows the use of m-0, mt-0, mr-0, ml-0, and mb-0 classes to reset the margins on an element.

Output:

👁 Image
 

Example 2: The below example shows how to use mx-0 and my-0 classes to reset the margin in the horizontal and vertical directions respectively.

Output:

👁 Image
 

Reference: https://primer.style/product/css-utilities/#reset-margins

Comment