SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/social-buttons

7 CSS Social Buttons

5 Pure CSS2 with JSPublished 2026-10-05Free · no sign-up

Seven share and follow buttons that load no third-party scripts: plain share links, the system share sheet with a copy fallback, follow buttons in brand colours, compact round buttons, outlined share buttons for articles, a sticky vertical share bar and a copy-link button.

01. Share Links Without Scripts

SocialShare

Share buttons as plain links to each network's share URL, with the page address encoded in the query string. No third-party script is loaded, so nothing tracks visitors, and each link has a visible name such as Share on LinkedIn.

View code
<ul class="soc1"><li><a class="x" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fexample.com%2Fpost" target="_blank" rel="noopener">Share on X<span class="sr"> (opens in a new tab)</span></a></li><li><a class="li" href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fpost" target="_blank" rel="noopener">Share on LinkedIn<span class="sr"> (opens in a new tab)</span></a></li><li><a class="em" href="mailto:?subject=Worth%20a%20read&amp;body=https%3A%2F%2Fexample.com%2Fpost">Share by email</a></li></ul>
.soc1 { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; font: 600 13px Inter, system-ui, sans-serif; }
.soc1 a { display: inline-block; padding: 9px 14px; border-radius: 8px; color: #fff; text-decoration: none; }
.soc1 .x { background: #000; } .soc1 .li { background: #0a66c2; } .soc1 .em { background: #475467; }
.soc1 a:hover { filter: brightness(1.15); }
.soc1 a:focus-visible { outline: 3px solid #84adff; outline-offset: 2px; }
.soc1 .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

02. Native Share with Fallback

SocialWeb Share

On phones, navigator.share() opens the system share sheet with every app the person uses. Where it is not available, the same button copies the link instead and says so, so there is always one obvious way to share.

View code
<div class="soc2"><button>Share this page</button><p role="status"></p></div>
.soc2 { display: grid; justify-items: start; gap: 8px; font: 14px Inter, system-ui, sans-serif; }
.soc2 button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 10px; background: #f8fafc; color: #0f172a; font: 700 14px Inter, system-ui, sans-serif; cursor: pointer; }
.soc2 button::before { content: "↗"; }
.soc2 p { margin: 0; min-height: 1.2em; color: #86efac; font-size: 13px; }
.soc2 button:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
var b = document.querySelector('.soc2 button'), st = document.querySelector('.soc2 p'), url = 'https://example.com/post';
function copy(t) { var a = document.createElement('textarea'); a.value = t; a.style.position = 'fixed'; a.style.opacity = '0'; document.body.appendChild(a); a.select(); var ok = false; try { ok = document.execCommand('copy'); } catch (e) {} a.remove(); return ok; }
b.onclick = function () {
  if (navigator.share) { navigator.share({ title: 'Worth a read', url: url }).catch(function () {}); return; }
  var done = function () { st.textContent = 'Link copied to your clipboard.'; }, fail = function () { st.textContent = copy(url) ? 'Link copied to your clipboard.' : 'Copy this link: ' + url; };
  if (navigator.clipboard) navigator.clipboard.writeText(url).then(done, fail); else fail();
};

03. Follow Buttons with Brand Colours

SocialFollow

Follow links styled with each network's colour and a simple letter mark, each opening the profile. The visible text says Follow on and the network, which is clearer than a row of unlabelled logos for people who do not recognise every icon.

View code
<div class="soc3"><a href="#youtube" class="yt"><span aria-hidden="true">▶</span>Follow on YouTube</a><a href="#instagram" class="ig"><span aria-hidden="true">◎</span>Follow on Instagram</a><a href="#github" class="gh"><span aria-hidden="true">{}</span>Follow on GitHub</a></div>
.soc3 { display: grid; gap: 8px; width: 240px; max-width: 100%; font: 600 14px Inter, system-ui, sans-serif; }
.soc3 a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: #fff; text-decoration: none; }
.soc3 span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,.2); font-size: 12px; }
.soc3 .yt { background: #cc0000; } .soc3 .ig { background: linear-gradient(90deg, #b62a90, #e1306c, #d65a17); } .soc3 .gh { background: #24292f; }
.soc3 a:focus-visible { outline: 3px solid #84adff; outline-offset: 2px; }

04. Round Icon Buttons with Names

SocialIcons

Compact round buttons for a footer, each showing a short mark with the full network name as its accessible name and as a title tooltip. The circle outline fills on hover and focus so the active one is easy to see.

View code
<ul class="soc4"><li><a href="#mastodon" aria-label="Mastodon" title="Mastodon">M</a></li><li><a href="#bluesky" aria-label="Bluesky" title="Bluesky">B</a></li><li><a href="#linkedin" aria-label="LinkedIn" title="LinkedIn">in</a></li><li><a href="#rss" aria-label="RSS feed" title="RSS feed">rss</a></li></ul>
.soc4 { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; }
.soc4 a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #475569; border-radius: 50%; color: #e2e8f0; font: 800 13px Inter, system-ui, sans-serif; text-decoration: none; transition: background .2s, color .2s; }
.soc4 a:hover, .soc4 a:focus-visible { background: #f8fafc; color: #0f172a; }
.soc4 a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

05. Outlined Share Buttons

SocialOutline

A quieter share row for articles: outlined buttons in the site's own colours rather than brand colours, so they do not shout over the content. A Share label introduces the group, which is a list inside a labelled region.

View code
<div class="soc5" role="region" aria-labelledby="soc5h"><p id="soc5h">Share</p><ul><li><a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fexample.com" target="_blank" rel="noopener">X</a></li><li><a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fexample.com" target="_blank" rel="noopener">Facebook</a></li><li><a href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com" target="_blank" rel="noopener">LinkedIn</a></li></ul></div>
.soc5 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 14px Inter, system-ui, sans-serif; }
.soc5 p { margin: 0; color: #475467; font-weight: 600; }
.soc5 ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.soc5 a { display: inline-block; padding: 6px 12px; border: 1px solid #d0d5dd; border-radius: 999px; color: #344054; font-weight: 600; text-decoration: none; }
.soc5 a:hover { border-color: #101828; color: #101828; }
.soc5 a:focus-visible { outline: 3px solid #84adff; outline-offset: 2px; }

06. Vertical Share Bar

SocialSticky

A slim vertical bar beside a long article, sticky so it stays in view while reading. It is a labelled aside of share links, and it moves under the article on narrow screens instead of covering the text.

View code
<div class="soc6"><aside aria-label="Share this article"><a href="#x" aria-label="Share on X">X</a><a href="#in" aria-label="Share on LinkedIn">in</a><a href="#mail" aria-label="Share by email">@</a></aside><article><h3>Notes on calm design</h3><p>Fewer colours, more space, clear actions.</p><p>Every element earns its place.</p></article></div>
.soc6 { display: grid; grid-template-columns: 44px 1fr; gap: 14px; width: 340px; max-width: 100%; font: 14px Inter, system-ui, sans-serif; }
.soc6 aside { position: sticky; top: 10px; align-self: start; display: grid; gap: 6px; }
.soc6 aside a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #1e293b; color: #e2e8f0; font-weight: 800; text-decoration: none; }
.soc6 aside a:hover { background: #334155; }
.soc6 h3 { margin: 0 0 6px; color: #fff; } .soc6 p { margin: 0 0 8px; color: #94a3b8; }
.soc6 a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
@media (max-width: 300px) { .soc6 { grid-template-columns: 1fr; } .soc6 aside { order: 2; grid-auto-flow: column; justify-content: start; } }

About these CSS Social Buttons

Links, not widgets

Official share widgets load scripts that track visitors across sites and slow the page. A plain link to each network's share URL does the same job with no script and no tracking.

Use the system share sheet

On phones, navigator.share() opens the share options people already use. Fall back to copying the link where it is not available.

Words beat logos

Not everyone recognises every logo. Visible text such as Share on LinkedIn is clearer, and icon-only buttons need an aria-label with the network's name.

Warn about new tabs

If a share link opens a new tab, say so in the link text or in visually hidden text, so the change of context is not a surprise.

Frequently asked questions

Can I use the networks' logos?

Brand guidelines usually allow their logos on share buttons; the demos use simple letter marks to stay generic.

Should I show share counts?

Most networks no longer provide them, and low counts can discourage sharing.

Does Web Share work on desktop?

In some desktop browsers, yes. The demo falls back to copying the link elsewhere.