October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
HTML CSS

How to Create Full-Bleed Columns with Bottom Padding in wkhtmltopdf

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put the background on an outer column that reaches the page edge, then put the text in an inner wrapper with the top and bottom padding. Keep wkhtmltopdf page margins as a separate page-geometry decision. This prevents the padding needed for readable content from shrinking the colored surface, but you must test short and multipage output because wkhtmltopdf’s page-breaking behavior cannot guarantee a colored strip at every physical page bottom.

Separate the painted surface from the content inset

The conflict comes from asking one box to do two jobs. A page or column that must paint to the edge cannot also be the box that supplies the readable inset. Use two layers:

  • Outer column: controls the width and background color. It is allowed to touch the page edge.
  • Inner content wrapper: contains headings, paragraphs and other content. Apply the desired top, right, bottom and left padding here.

The original Stack Overflow question from October 16, 2017 is unanswered, so this is a practical CSS structure to test rather than a recipe verified by that thread. It addresses the geometry of the problem without using page-level padding to move the background itself inward.

Minimal HTML structure

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    html, body {
      margin: 0;
      padding: 0;
    }

    * {
      box-sizing: border-box;
    }

    .layout {
      display: table;
      width: 100%;
      table-layout: fixed;
    }

    .column {
      display: table-cell;
      width: 40%;
      vertical-align: top;
      background: #16324f;
      color: #fff;
    }

    .column__inner {
      padding: 28px 24px 44px;
    }

    .main {
      display: table-cell;
      width: 60%;
      vertical-align: top;
      background: #fff;
      color: #222;
    }

    .main__inner {
      padding: 28px 32px 44px;
    }
  </style>
</head>
<body>
  <div class="layout">
    <aside class="column">
      <div class="column__inner">
        <h1>Report</h1>
        <p>The background belongs to the outer column; this text belongs to its inner wrapper.</p>
      </div>
    </aside>
    <main class="main">
      <div class="main__inner">
        <h2>Content</h2>
        <p>Additional content goes here.</p>
      </div>
    </main>
  </div>
</body>
</html>

For a full-height colored rail, make the outer column the element whose height is determined by the layout. Do not add the content padding to .column itself. If a fixed height is introduced, check overflow on long pages; a fixed height can clip or leave an unexpectedly short background.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Decide what “bottom padding” means

Space after content on a short page

If the requirement is simply that the last line is not pressed against the colored panel’s bottom, the inner wrapper’s padding-bottom is the right control. It follows the content and works independently of wkhtmltopdf’s page margins.

A colored strip at the bottom of every PDF page

A per-page strip is a different requirement. A wrapper’s bottom padding applies where that wrapper ends; it does not automatically create a reserved, colored band on every physical page when the content is split. Treat the strip as page geometry and validate the generated PDF on a document longer than one page. If the strip must be exact for printing, also obtain the printer’s trim and bleed specifications; PDF background rendering is not the same as commercial print bleed.

Keep page margins separate from CSS padding

wkhtmltopdf exposes independent page margins and page dimensions. The official settings document names --margin-top, --margin-bottom, --margin-left, --margin-right, --page-size, --page-width and --page-height. A margin reserves space in the page box; it does not add padding inside a colored column.

Requirement Primary control What it changes
Keep a column’s color at the edge while moving text inward Nested inner wrapper with CSS padding Separates the painted surface from the readable inset. This is an inferred layout strategy and needs testing with your build.
Reserve space at the bottom of each page --margin-bottom (or the equivalent global setting) Changes usable page area and can alter where content breaks; it is not inner column padding.
Use a custom paper size --page-width and --page-height, or --page-size for a named size Defines the PDF page box. A4 is wkhtmltopdf’s documented default.
Prevent a paragraph or element from splitting where supported page-break-inside May reduce undesirable splits; it does not create bottom padding.

Set the HTML and body margins to zero only when that is actually your intended geometry. Then choose wkhtmltopdf margins deliberately. If the background must occupy the margin area, do not replace the inner padding with a page margin.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Choose page dimensions and background handling explicitly

For a standard sheet, specify the intended named size and margins in the conversion command. For a custom page, specify both dimensions rather than relying on defaults. When the design depends on CSS background colors or images, include --background; --no-background disables them.

wkhtmltopdf 
  --page-size A4 
  --margin-top 0 
  --margin-right 0 
  --margin-bottom 0 
  --margin-left 0 
  --background 
  report.html report.pdf

Zero margins are not proof of edge-to-edge color. Archived issue reports describe white space in some setups despite zero margins. One report found explicit dimensions useful in its configuration, while a later report still saw white space with wkhtmltopdf 0.12.6 and patched Qt. Treat those reports as diagnostics, not universal fixes.

Page breaks and nested columns

The Debian bullseye wkhtmltopdf manual explains that WebKit lays the document out as one long page and then cuts it into pages. It states that “The current page breaking algorithm of WebKit leaves much to be desired.” Patched Qt supports page-break-inside as a partial remedy, but the manual says there is no easy general solution.

Use the property on elements where keeping them together matters:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
.card,
figure,
table {
  page-break-inside: avoid;
}

Do not expect it to manufacture space below the last item or preserve a fixed background band. A long table, an oversized image or a block taller than the remaining page can still force a break. Test the exact HTML, fonts, assets, wkhtmltopdf version and Qt build used in production.

Headers, footers and reserved space

A dynamic footer is another page-geometry problem, not a substitute for the inner wrapper. The official settings documentation warns that excessive header spacing can place the header outside the PDF and says the condition can be corrected with margin.top. Apply the same discipline to a footer: reserve enough bottom margin for it, then verify that the content and footer do not overlap. An archived issue report also describes tuning the bottom margin for a dynamic footer.

A diagnostic sequence for white edges or clipped content

  1. Confirm the target edge. Decide whether the color must reach the physical page edge, the PDF page box, or merely sit behind the column’s content. These are different acceptance tests.
  2. Inspect the box tree. Ensure the background is on the outer column and that only the inner wrapper has the content padding. Remove accidental padding on a page-level container.
  3. Reset CSS defaults. Check html, body, headings and paragraphs for default margins. Set them intentionally rather than assuming a browser reset is present.
  4. Check dimensions. Compare CSS widths and heights with --page-size, --page-width and --page-height. A width that exceeds the page box can appear as a white sliver or force scaling.
  5. Check margins and scaling. Print the effective command, including all four margin flags, and compare it with the CSS. Test with smart-shrinking or other scaling settings held constant between runs; the issue reports do not establish one universal setting.
  6. Verify backgrounds. Include --background when the design relies on printed backgrounds. Make sure the result is not being generated with --no-background.
  7. Compare builds. Record the exact wkhtmltopdf and Qt build. The archived issue reports show conflicting outcomes, so a workaround from one configuration cannot be promoted to a compatibility guarantee.
  8. Render two fixtures. Use one short page to check bottom padding and one multipage document to check fragmentation, page margins and any repeated strip.

Performance and reliability considerations

  • Keep the layout simple while diagnosing. Nested wrappers make the ownership of padding clear; unnecessary fixed heights and absolute positioning make pagination harder to reason about.
  • Use the same fonts, images and CSS in local and production conversions. A changed font metric can move a line and trigger a different page break.
  • Compare generated PDFs, not only browser previews. wkhtmltopdf uses its own WebKit renderer, and its pagination can differ from a current browser.
  • Keep a known-good fixture in automated checks: one short document, one document that crosses a page boundary, and one document containing the longest expected column content.
  • Because the wkhtmltopdf GitHub repository has been archived and read-only since January 2, 2023, document the binary and patched-Qt build you deploy. The available sources do not provide a complete version-by-version compatibility matrix.

Or skip the browser setup

If your input is a public URL and you need a rendered capture rather than a local wkhtmltopdf process, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

One GET request returns PNG, JPEG, WebP or a PDF. The parameter set covers full-page capture with lazy images, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper size and margins, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for parameters and response handling. The same request from Python:

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

And from Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

FAQ

Should I use a page margin or CSS padding for a colored sidebar?

Use CSS padding on an inner wrapper for the sidebar’s text. Use a page margin only when you intentionally want to reserve space in the PDF page box.

Will this pattern guarantee identical output on every wkhtmltopdf build?

No. The cited documentation describes pagination as imperfect, and archived issue reports show different results for explicit dimensions and zero margins. Pin and test the exact binary and Qt build you deploy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How can I tell whether a white edge is caused by CSS or the converter?

Render a minimal fixture with zero HTML/body margins, an explicitly sized page, and a single outer colored element. Then add the real columns and content incrementally. The comparison isolates box dimensions, page settings and pagination effects without changing several variables at once.

Best Value
HP LaserJet M110w Wireless Black & White Printer, Print, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more

Frequently Asked Questions

Should I use a page margin or CSS padding for a colored sidebar?

Use CSS padding on an inner wrapper for the sidebar’s text. Use a page margin only when you intentionally want to reserve space in the PDF page box.

Will this pattern guarantee identical output on every wkhtmltopdf build?

No. The cited documentation describes pagination as imperfect, and archived issue reports show different results for explicit dimensions and zero margins. Pin and test the exact binary and Qt build you deploy.

How can I tell whether a white edge is caused by CSS or the converter?

Render a minimal fixture with zero HTML/body margins, an explicitly sized page, and a single outer colored element. Then add the real columns and content incrementally. The comparison isolates box dimensions, page settings and pagination effects without changing several variables at once.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.