Skip to content

Social Media Post Card

Dark Bootstrap 5 social post card with photo, double-tap like, save, native share with copy-link fallback and an inline comment thread.

Also known as: social feed post, instagram style post card, social media card, feed post component

Bootstrap 5 Social Feeds Responsive Dark #card #comments #dark #like #social

Social Media Post Card live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A dark Bootstrap 5 social media post card with an author header, photo, like, comment, share and save actions, and an inline comment thread. Use it in social feeds, community apps, blog activity streams or any UI mockup that needs a realistic post.

How it works

The card is an article.sp-post inside the .sp-wrap backdrop. The .sp-head holds a gradient initials avatar, the author name with a verified badge, a time element and a Bootstrap dropdown with Copy link, Mute and Report actions. Below come the post text with hashtag links, the .sp-media photo, a .sp-stats row and the .sp-actions bar.

The script runs on DOMContentLoaded for every .sp-post. The like button toggles aria-pressed, swaps bi-heart for bi-heart-fill and adds one to the count stored in data-likes. Double-clicking the photo also likes the post and plays the .sp-burst heart animation by adding sp-burst--play. The save button toggles a bookmark icon. Share uses navigator.share() when the browser supports it and otherwise copies data-share-url with the Clipboard API; if the clipboard is blocked, the link is shown in the .sp-status message instead.

The Comment button is a Bootstrap collapse toggle for the comment section and focuses the input when it opens. In .sp-comment-form the Post button stays disabled until text is typed; submitting appends a new .sp-comment (text inserted with textContent, so it is safe) and updates .sp-comment-count.

Customization

  • --sp-accent and --sp-accent-rgb on .sp-wrap in style.css: change the rose color of the active like, Post button, avatar ring and focus outline.
  • --sp-card, --sp-surface and --sp-bg: recolor the card, comment bubbles and page background; use light values for a light theme.
  • --sp-radius: rounds the card and, through a calc(), the photo.
  • data-likes on .sp-post: the starting like count; the displayed number is formatted with toLocaleString.
  • data-share-url on .sp-post: the link used by Share and Copy link.
  • Remove show from the collapse wrapper and set aria-expanded="false" on the Comment button to start with comments hidden.
  • font-size: 5rem in .sp-burst: makes the double-click heart larger or smaller.
  • maxlength="280" on .sp-comment-input: limits comment length.

Use cases

  • Social feeds: a post with author header, photo and action buttons fits a scrolling timeline
  • Community apps: double-tap like, save and native share let members react quickly
  • Blog activity streams: an inline comment thread keeps the discussion under the post
  • UI mockups: a realistic dark post card makes prototypes look believable

Accessibility

The article is labelled by the author name, and decorative avatars are hidden with aria-hidden. The verified and public icons have role="img" with a label. Like and save are toggle buttons with aria-pressed; the icon-only save and menu buttons carry aria-label. The Comment button exposes aria-expanded and aria-controls. The comment input has a visually hidden label, and confirmations such as "Link copied to clipboard." or "Comment posted." are announced through the role="status" region. Focus outlines use the accent color, and all animations stop under prefers-reduced-motion.

Usage notes

Requires Bootstrap 5.3 with its JS bundle and Bootstrap Icons. When repeating the card in a feed, give each copy a unique collapse id (sp-comments-1) and input id (sp-comment-input-1).

Social Media Post Card 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
Social Feeds
License
Free for personal and commercial use

Questions about this template

Can I use the Social Media Post Card 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">
Social Media Post Card – free Bootstrap 5 social feed template
Social Media Post Card · free Bootstrap 5 social feed template

More Social Feeds

Reels-Style Vertical Feed – free Tailwind CSS social feed template

Reels-Style Vertical Feed

Tailwind CSS reels-style vertical feed with snap-scrolling full-height photos, like, comment, share and save buttons, double-click to like and keyboard navigation.

Tweet-Style Post Card with Image – free Pure CSS social feed template

Tweet-Style Post Card with Image

Microblog post card with avatar, verified badge, attached photo and working like, repost, bookmark and share buttons. Pure CSS with a little vanilla JS.

Pinterest-Style Pin Board – free Bootstrap 5 social feed template

Pinterest-Style Pin Board

Bootstrap 5 masonry pin board with photo pins, topic filter chips, save buttons and a live saved counter.