Academy

/

Layout & Design

/

Margins & Paddings

Margins & Paddings

Explore the essentials of web design with our tutorial on how to effectively use paddings and margins to structure and space elements on your webpage.

You can adjust padding & margins parameters by clicking and dragging, or input a specific value manually. There are also predefined padding options for convenience.

To adjust padding or margins quickly, hold the ALT key and drag to apply values to top and bottom or left and right simultaneously, or hold the SHIFT key and drag to apply values to all four sides at once.  

Padding

Imagine you have a card with content inside it. By default, the content stretches to fill the available space. To create some breathing room within the card, you use padding. 

Margins

Margins, on the other hand, help you create space outside of your element, perfect for separating grouped items.

Negative margin

Negative margins allow for overlapping elements or pulling an element in a specific direction. It's important to use small values to avoid disrupting the layout on smaller devices.

Margin auto: Centering an element

The 'margin auto' option can center an element by distributing available space evenly between the left and right margins. This requires the element to have a defined width and does not work with inline or inline-block display options.

Margin align trick 

For unevenly aligned elements, like buttons with varying text lengths, applying a 'margin top auto' can align them perfectly at the bottom.

Table of content

Create your website visually – fast and easy.

Build a stunning website with ease using our visual builder. No experience needed – just drag, drop, and launch your site today.

Build and publish websites for free

Build and host your site with a custom domain for free. Upgrade anytime for expanded limits.

Build for free

Built in Divhunt

We use cookies.

By clicking “Accept All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View ourCookie Policyfor more information.

Optahunt

Preferences

Manage your cookie preferences.

Essentials

Always Active

These are required for the website to work, like remembering your privacy settings, keeping you logged in, or enabling secure payments.

Performance

These help us understand how people use our site (like which pages are most popular) so we can make improvements.

Personalization

These allow the site to remember your preferences (such as language or region) and provide enhanced features.

Advertising & Targeting

These are used to deliver ads more relevant to you, limit how often you see them, and measure campaign performance.

Save my preferences

You can always change these settings later via ourCookie Policy pagepage, or via the cookie widget placed at the bottom left of the page.