Skip to content

Newsletter Section with Background Photo

Bootstrap 5 newsletter signup section over a full-width mountain photo with a glass form card, email validation and a simulated subscribe state.

Also known as: newsletter signup with photo background, email capture section, subscribe section with background image, newsletter hero banner

Newsletter Section with Background Photo live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A Bootstrap 5 newsletter signup section placed over a full-width mountain photo, with a headline, reader stats and a frosted glass form card. Use it on blogs, travel and outdoor sites, or any landing page that needs a strong email capture block.

How it works

The root is section.nbp-section, a flex container with a min-height of 560px. Its background stacks a dark diagonal linear-gradient on top of the photo stored in the --nbp-photo custom property, so white text stays readable on every part of the image. Inside a Bootstrap container, a row splits into two columns from the lg breakpoint: the copy column with the .nbp-eyebrow pill, the display-5 heading, the lead text and the .nbp-stats list, and the form column with the .nbp-panel card. The panel uses a translucent background and backdrop-filter: blur(14px) for the glass effect. On phones the columns stack.

The form .nbp-form has an optional first name field, a required email field inside an input-group with an envelope icon, and a digest checkbox. The script runs on DOMContentLoaded for every .nbp-section. On submit it calls preventDefault(), checks the email with EMAIL_PATTERN and, if it fails, adds Bootstrap's is-invalid class, sets aria-invalid and moves focus back to the field. A valid address disables .nbp-btn, shows the spinner and after a short simulated delay writes a personal confirmation into .nbp-status.

Customization

  • --nbp-photo in .nbp-section: point it to your own image to change the background.
  • --nbp-overlay in .nbp-section: make the left side of the gradient lighter or darker to balance contrast with your photo.
  • --nbp-accent and --nbp-accent-hover: change the color of the button, eyebrow pill, stat borders and focus rings.
  • min-height: 560px in .nbp-section: increase it for a taller hero-like block or remove it for a compact strip.
  • background-position: center 40% in .nbp-section: move the focal point of the photo up or down.
  • The window.setTimeout call in script.js: replace it with fetch() to your mailing list provider and show its response in .nbp-status.
  • Remove the first name field or the digest form-check if you only need the email address.

Use cases

  • Blogs: a full-width mountain photo with a glass form card turns readers into email subscribers
  • Travel and outdoor sites: reader stats and a first name field sit over a scenic image
  • Landing pages: the email field is validated and shows a spinner and confirmation after submitting
  • Content publishers: an optional digest checkbox lets visitors choose how often they get updates

Accessibility

The section is labelled by its heading through aria-labelledby. Every input has a visible label, the email field is linked to its error message with aria-describedby, and the script toggles aria-invalid with the error state. .nbp-status is a role="status" live region, so the confirmation is announced. Inputs and the button get high-contrast amber focus rings, the spinner is aria-hidden, and hover movement on the button is turned off under prefers-reduced-motion.

Usage notes

Requires Bootstrap 5 (added automatically) and Bootstrap Icons. The photo comes from Unsplash; replace it with your own image. Choose a photo with calm areas behind the text or raise the overlay opacity. Several sections can live on one page because the script scopes everything to each .nbp-section; just give each copy unique id values.

Newsletter Section with Background Photo at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile, dark design
Category
Newsletter Sections
License
Free for personal and commercial use

Questions about this template

Can I use the Newsletter Section with Background Photo code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Newsletter Section with Background Photo – Bootstrap 5 newsletter sections component screenshot
Newsletter Section with Background Photo · Bootstrap 5 Newsletter Sections

More Newsletter Sections

Newsletter Signup with Side Image – Tailwind CSS newsletter sections preview

Newsletter Signup with Side Image

Split Tailwind CSS newsletter section with a photo on one side and a validated email form with topic chips and a success state on the other.

Inline Newsletter Form – Pure CSS newsletter sections preview

Inline Newsletter Form

Compact pure CSS newsletter signup with a pill email field, an animated subscribe button and loading, error and success states.

Newsletter Signup Card – Tailwind CSS newsletter sections preview

Newsletter Signup Card

Bold Tailwind CSS newsletter signup card with inline email validation, a loading spinner, privacy note and an animated success state.