Skip to content

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.

Also known as: microblog post, social media post card, social post embed, social post mockup, microblog post card

Pure CSS Social Feeds Responsive #card #feed #image #post #social

Tweet-Style Post Card with Image live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A microblog post card in the style of a social media timeline, with avatar, verified badge, post text, an attached photo, a views line and a row of action buttons. It is built with pure CSS and a short vanilla JavaScript file, and works well for embedded testimonials, social proof sections, social feed mockups and community pages.

How it works

The root article.tpc-card starts with a .tpc-head that contains the round .tpc-avatar, the .tpc-author block (.tpc-name, the inline SVG .tpc-verified badge, .tpc-handle and a relative time.tpc-ago) and a .tpc-more options button. Below it, .tpc-text holds the post with mention and hashtag links (.tpc-link), figure.tpc-media shows the photo in a fixed 16 / 9 box with object-fit: cover, and .tpc-meta shows the full date and the views count.

The .tpc-actions row has five buttons: reply, repost, like, bookmark and share. Each .tpc-action sets its own --tpc-tone, which colors the icon and its hover circle (color-mix() at 12%). Repost, like and bookmark are toggle buttons with aria-pressed. On click the script flips aria-pressed, adds or removes one from data-count, writes the short form ("1.2K") into .tpc-count and adds .is-popping for a small bounce. The share button tries navigator.clipboard and shows "Link copied to clipboard" in .tpc-status. Without JavaScript the card still renders fully; only the toggles do nothing.

Customization

  • --tpc-like, --tpc-repost, --tpc-reply and --tpc-save on .tpc-card: the active and hover color of each action.
  • --tpc-verified: color of the badge; delete the svg.tpc-verified element for accounts without one.
  • --tpc-radius and --tpc-media-radius: corner radius of the card and of the attached photo.
  • aspect-ratio in .tpc-media: use 1 / 1 or 4 / 5 for square or portrait attachments.
  • data-count on a .tpc-action button: the starting number, also update the visible .tpc-count text.
  • aria-pressed="true" on .tpc-action--like: the like starts in its filled state, as in the demo. Set it to false for a neutral card.
  • --tpc-bg, --tpc-text, --tpc-muted and --tpc-border: swap them for a dark mode card.

Use cases

  • Testimonial sections: embed a customer post with avatar, verified badge and photo as social proof
  • Social feed mockups: show a realistic timeline post with reply, repost, like, bookmark and share buttons
  • Community pages: like and repost counters update with a short number format
  • Landing pages: a post with an attached photo and views line adds credibility
  • Prototypes: share copies a link and shows a status message

Accessibility

The card is an article labelled by the author name. All controls are real button elements with aria-label or a data-label that the script turns into a label with the current number, for example "Like, 1,208". Toggle state is exposed with aria-pressed. Bookmark and share feedback is announced through the role="status" region. Every interactive element has a visible :focus-visible outline, and action buttons are at least 44px tall. The verified badge is an svg with role="img" and a label, and decorative icons are hidden. Animations are removed with prefers-reduced-motion: reduce.

Usage notes

The avatar and the attached photo come from Unsplash; replace them with your own images. When you render several cards, give each one a unique id for the author link and its aria-labelledby. The counters are local only; add a fetch() call where the script comment marks the spot to save likes and reposts.

Tweet-Style Post Card with Image at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
None
Layout
Responsive, works on mobile
Category
Social Feeds
License
Free for personal and commercial use

Questions about this template

Can I use the Tweet-Style Post Card with Image 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?

There is nothing to install. 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

No dependencies. Pure HTML, CSS and JavaScript.

Tweet-Style Post Card with Image – Pure CSS social feeds component screenshot
Tweet-Style Post Card with Image · Pure CSS Social Feeds

More Social Feeds

Reels-Style Vertical Feed – Tailwind CSS social feeds preview

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.

Pinterest-Style Pin Board – Bootstrap 5 social feeds preview

Pinterest-Style Pin Board

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

Social Media Post Card – Bootstrap 5 social feeds preview

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.