How to Create Social Media Icons with Pure CSS (No Images) 2026
You can create fast-loading social media icons with pure CSS and no image files at all. Years ago we replaced the image-based social buttons in our sidebar with styled letters: Facebook became an “f” on blue, Twitter a “t” on light blue. They looked almost the same, loaded instantly and cut several server requests. The idea still works in 2026, with updated brand colours and Google+ long gone. Here’s how to make CSS social media icons, plus a modern inline SVG option.
![]()
Quick answer: Wrap a few links in a container, give each link a short text label (f, X, in, ▶) and a class, then style them in CSS with the brand background colour, white text, padding and border-radius. Add an aria-label to each link for accessibility. For sharper logos with no extra requests, paste inline SVG icons instead of letters.
Table of Contents
Why make social media icons with pure CSS?
- No extra downloads: no image files or icon font to load, so nothing to lazy load.
- Sharp at any size and easy to recolour.
- No third-party scripts that slow pages or track visitors.
Step 1: The HTML
Add this where you want the icons, such as a Custom HTML widget or block:
<div class="social-icons">
<a class="si facebook" href="https://www.facebook.com/yourpage" aria-label="Facebook" target="_blank" rel="noopener">f</a>
<a class="si x" href="https://x.com/yourhandle" aria-label="X (Twitter)" target="_blank" rel="noopener">X</a>
<a class="si linkedin" href="https://www.linkedin.com/company/yourpage" aria-label="LinkedIn" target="_blank" rel="noopener">in</a>
<a class="si youtube" href="https://www.youtube.com/@yourchannel" aria-label="YouTube" target="_blank" rel="noopener">▶</a>
<a class="si whatsapp" href="https://wa.me/910000000000" aria-label="WhatsApp" target="_blank" rel="noopener">W</a>
</div>Step 2: The CSS
Add this to Appearance > Customize > Additional CSS or your stylesheet:
.social-icons { display: flex; gap: 8px; margin: 10px 0; }
.si {
display: inline-flex; align-items: center; justify-content: center;
width: 40px; height: 40px; border-radius: 50%;
color: #fff; font: 700 18px/1 Georgia, serif;
text-decoration: none; transition: transform .15s;
}
.si:hover, .si:focus { transform: translateY(-2px); color: #fff; }
.facebook { background: #1877F2; }
.x { background: #000; }
.linkedin { background: #0A66C2; }
.youtube { background: #FF0000; font-size: 14px; }
.whatsapp { background: #25D366; }Use border-radius: 6px for rounded squares instead of circles, and change the width, height and font size for bigger icons. Georgia is a web safe font, so it renders the same everywhere.
Modern option: inline SVG icons
Letters are fast, but real logos are clearer. Inline SVG gives you both: copy a brand icon’s SVG code from Simple Icons (free brand icons) and paste it inside the link instead of the letter. Add this CSS:
.si svg { width: 20px; height: 20px; fill: currentColor; }It is still part of the page, so no extra requests. Icon libraries such as Font Awesome are another route; here’s how to add Font Awesome icons to any website, though they add a stylesheet and font file.
What changed since the original version
- Google+ closed in 2019; its “g+” icon is gone.
- Twitter is now X with a black brand colour.
- Facebook and LinkedIn updated their blues.
- Flexbox and
gapreplace manual margins, and the old-webkit-/-moz-prefixes for border-radius are no longer needed.
Want share buttons too? See how to make floating social share icons with Bootstrap 5.
FAQ
Are CSS icons accessible?
Yes, with an aria-label on each link so screen readers announce the network name instead of “f”.
Can I use brand logos freely?
Brands allow their logos for linking to your profiles, but follow their guidelines and don’t alter the logo shape.
Do these icons work in dark mode?
Yes. The brand backgrounds stay visible; for X, add a light border in dark mode.
Get our free weekly email: new tech guides and tools, no spam.
New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.
One email a week. Unsubscribe anytime. See our privacy policy.







Social media is a great tool to get enough traffic and to do so we need social sharing icons which are creative.
Thanks for sharing
Thank you very much buddy. It saved my time,i really help me for me site customization options ,
Awesome, now i dont need a plugin anymore. So my website will load faster, great article :)
Thanks for Sharing this post,Social media icons is very important for any website in now a days,i will change in my website Social medial icons with css. Thanks :)
i think you are a web developer or a designer…for easy way to do the css and html go through the adobe dream weaver..thanks for your valueble coding for CSS
The normal one would just be styled using the style sheet attributes described above when using the normal <h1>heading 1</h1> tag.
With CSS, lists can be styled further, and images can be used as the list item marker.
It is easy to turn off certain links, headers, or even menu items by simply setting their style to ‘hidden’. This can help you to roll out Confluence to users that may not be very Wiki-savvy yet. The simpler the UI, the easier it may be for them to use. However, please remember that removing the link to a part of the application does not mean that the functionality is not available. Every user can still change their style from within their browsers, or access the URL directly. Don’t rely on CSS to disable parts of Confluence.
There may be other variants in the font family as well, such as fonts with old-style numerals, small-caps numerals, condensed or expanded letters, etc. CSS 2.1 has no properties that select those.
Thank you chandra!for shire the coding ,i really help me for me site customization options ,
Hi p.Chandra! Thanks for the coding for the social media icons using pure CSS. I must try it. I really love it because of its customization options.
Hey man, this is really very nice, to increase up the loading speed these will actually help a lot.
Although, readers might miss the old icons as they are more interactive but then webmasters have no choice, but to provide them with the best experience.
I will surely try this out and let you know
Thanks for the share..!!
This replaces the social media icons, and not the interactive icons which require javascript also.
Nice gadget and tips everyone should focus on css as it is easy to load faster then the java script.i truly admire the use of css.
Choosing the right social media icons for your site is important. This is the way you draw attention to your different accounts. Sure people may find you on the different sites, but it’s a lot easier if you help them out by including these icons somewhere on your site.
Regards
Paul D. Mitchell
It might be a good idea, however the text in itself, does not look very attractive. I think a simple, minimalist icons would not occupy much size, therefore could serguir using them as such.
Very good contribution.
The font can be changed to whatever font you feels looks best. We have Georgia for simplicity, looks good on Google+ icon and is web safe font.
Thanks!
Soon I will replace my image sprite for social profiles because pure CSS and HTML is always better than images.
And there are hundreds of customization options.