Free tools Windows power users keep installed
One-click scans. No signup required.
Use padding for space inside an element’s border, margin for space outside an individual element, and gap for gutters owned by a grid, flex, or multi-column layout. The right choice depends on where the space belongs—not just how the page looks.
How the CSS box model places space
Read an element’s box from the inside out: content → padding → border → margin. Padding separates the content from the border; margin separates the border box from surrounding content. They occupy different parts of the box and are not interchangeable.
A background applied to an element extends through its padding area. It does not turn margin into part of the element’s background.
What width and height include
With box-sizing: content-box, the default sizing model, an authored width or height measures the content area. Padding and border add to that size. With box-sizing: border-box, the declared dimensions include the content, padding, and border. Margin remains outside the border in either model.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
.content-box {
box-sizing: content-box;
width: 200px;
padding: 20px;
border: 2px solid;
}
.border-box {
box-sizing: border-box;
width: 200px;
padding: 20px;
border: 2px solid;
}
In the first example, the border box is wider than 200 pixels because padding and borders are added to the content width. In the second, the border box stays 200 pixels wide, leaving less room for content. Neither setting brings margin inside the declared width.
Choose padding, margin, or gap by who owns the space
| Property | Where the space is | Who controls it | Useful for |
|---|---|---|---|
padding |
Between content and border, inside the element | The element | Room between a card’s text and its edge |
margin |
Outside the element’s border | An individual element | Spacing an element from surrounding content |
gap |
Between items in a layout | The grid, flex, or multi-column container | Consistent gutters among sibling items |
Use padding for internal breathing room
Put padding on a component when its content should sit away from its edge. For example, card padding keeps text clear of the border while leaving the background visible beneath that space.
.card {
padding: 1rem;
border: 1px solid #ccc;
}
Use margin for space attached to an individual box
Use margin when an element itself needs separation from what surrounds it—for example, a heading with room below it. This puts responsibility for that spacing on the heading rather than on a group of siblings.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
.section-title {
margin-bottom: 1rem;
}
Use gap for space between layout items
When the parent lays out a group with grid, flexbox, or multiple columns, use gap to set the gutters at the container level. It separates adjacent items without adding a gutter at the container’s outer edges.
Recommended Free Tools
.cards {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1rem;
}
These are selection heuristics, not rules against combining properties. A card can have internal padding while its parent uses gap between cards.
Set row and column gaps
The gap shorthand applies to grid, flex, and multi-column containers. One value sets both row and column gaps; two values set the row gap first and the column gap second.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
.layout {
display: grid;
gap: 12px; /* row and column */
}
.layout-wide-columns {
display: grid;
gap: 12px 24px; /* row, then column */
}
The gap value is not necessarily the full visible distance between items. Child margins, container or item padding, and distributed alignment can increase the separation; grid alignment can also add space between tracks.
Why vertical margins sometimes do not add up
In block layout, adjoining vertical margins can collapse: they combine into one margin instead of being added arithmetically. When both adjoining margins are positive, the result is generally the larger margin, not their sum. The behavior can also occur between certain parent and descendant margins.
Margins do not collapse inside flex or grid containers. Collapse is not universal either; floated and absolutely positioned elements are among the exceptions. For gutters between flex or grid siblings, container-level gap gives an explicit spacing rule without block-margin collapsing.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Example: two adjoining block margins
.first {
margin-bottom: 24px;
}
.second {
margin-top: 16px;
}
If these are adjoining vertical margins in normal block flow, the separation is generally 24 pixels rather than 40 pixels. If the elements are flex or grid items, their margins do not collapse, so account for both margins and any container gap when judging the visible distance.
Debug spacing that looks wrong
- Inspect the element’s box model. In browser developer tools, select the element and check its content size, padding, border, and margins. MDN’s guide explains how developer tools expose these measurements: The box model.
- Check the parent’s layout mode. Determine whether it is block flow, flex, grid, or multi-column. This affects whether margins can collapse and whether
gapapplies. - Check both sides of the visible space. Look at child margins, padding, and the container’s gap. More than one property may contribute to the distance.
- Check alignment. Distributed alignment and grid track alignment can create additional separation beyond the declared gap.
- Check
box-sizing. If an element is wider or taller than expected, determine whether its padding and border add to the declared dimensions.
Screenshot a spacing issue for review
A screenshot can make a layout discrepancy easier to share with a teammate or attach to a bug report. If you want an image of the page, capture it in the browser yourself or use a screenshot API such as ScreenshotNeo.
Capture the page in your browser
- Open the page at the viewport size where the spacing looks wrong.
- Open your browser’s developer tools and inspect the relevant element’s box model and parent layout.
- Capture a screenshot using your browser or operating system’s screenshot feature, then share it with the inspected CSS details.
Or skip the browser setup
ScreenshotNeo’s API returns a screenshot or PDF from one GET request. See the ScreenshotNeo documentation for request options.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- It accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers indicate the page verdict and billing status.
- An MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs.
- The free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try it without a card.
Frequently Asked Questions
Can I use both padding and gap on the same layout?
Yes. Padding can provide room inside a component or around a container’s content while gap separates sibling items in that container.
Does gap replace margin everywhere?
No. Gap is for gutters in grid, flex, and multi-column layouts. Margin remains useful when spacing belongs to an individual element or the layout is not a gap container.
Why is the visible space larger than my gap value?
Margins, padding, distributed alignment, or grid track alignment may add to the declared gap.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

