Right margin

Right margin is a CSS property that defines the space between the right edge of an element and its surroundings, such as other elements, the browser window, or the edge of a container. Its syntax is “margin-right.” In HTML and CSS, a positive value increases the margin, while a negative value reduces it. By adjusting the right margin, you can change the horizontal position of an element to align text, images, and other content within a container. 

Margins can also visually separate content, create a sense of hierarchy, and improve the overall readability of a site. For example, the “margin-right” property enables you to move a paragraph away from an element, such as an image or heading, creating a visual break and making it easier to read.

Here's what a CSS margin-right property looks like:

<div style="margin-right: 25px;">

  <p>This is an example.</p>


In this example, the container element houses the sample text, with 25 pixels added to it on the right margin. As a result, the paragraph <p> moves 25 pixels away from the container's right edge.

You can apply right and auto margins to any block-level HTML element, including headings, paragraphs, and divs. Visit Webflow University to learn how to use spacing and padding effectively to make your web pages aesthetically pleasing and user-friendly.

A new way to learn and to build for the web

Get the best, coolest, and latest in design and no-code delivered to your inbox each week.

Shoot, something didn't work. Try again later, bud.