Outlined social icons set in diamonds that swing upright into filled squares on hover, while the glyph inside counter-rotates so it never tilts. A spring curve adds a small overshoot.
Also known as: rotated square social icons, diamond icon hover css, rhombus social buttons.
<ul class="hfx-social-icons-diamond"> <li><a class="hfx-social-icons-diamond-link" href="#" aria-label="Email"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3.5 7 8.5 6 8.5-6"/></svg></a></li> <li><a class="hfx-social-icons-diamond-link" href="#" aria-label="Share"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="m8.6 13.5 6.8 4M15.4 6.5l-6.8 4"/></svg></a></li> <li><a class="hfx-social-icons-diamond-link" href="#" aria-label="Chat"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.4 8.4 0 0 1-12.2 7.5L3 21l2-5.3A8.5 8.5 0 1 1 21 11.5Z"/></svg></a></li> <li><a class="hfx-social-icons-diamond-link" href="#" aria-label="Website"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9.5"/><path d="M2.5 12h19M12 2.5c2.6 2.6 3.8 5.8 3.8 9.5s-1.2 6.9-3.8 9.5c-2.6-2.6-3.8-5.8-3.8-9.5s1.2-6.9 3.8-9.5Z"/></svg></a></li> </ul>
.hfx-social-icons-diamond {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
display: flex;
align-items: center;
gap: 1.35em;
margin: 0;
padding: 0;
list-style: none;
}
.hfx-social-icons-diamond-link {
display: grid;
place-items: center;
width: 2.6em;
height: 2.6em;
border: 2px solid var(--c);
border-radius: 0.55em;
color: var(--c);
transform: rotate(45deg);
transition:
transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
background-color 0.25s ease,
color 0.25s ease;
}
.hfx-social-icons-diamond-link svg {
width: 1.25em;
height: 1.25em;
transform: rotate(-45deg);
transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hfx-social-icons-diamond-link:is(:hover, :focus-visible) {
transform: rotate(0deg);
background: var(--c);
color: #fff;
}
.hfx-social-icons-diamond-link:is(:hover, :focus-visible) svg { transform: rotate(0deg); }
@media (prefers-reduced-motion: reduce) {
.hfx-social-icons-diamond, .hfx-social-icons-diamond *, .hfx-social-icons-diamond::before, .hfx-social-icons-diamond::after, .hfx-social-icons-diamond *::before, .hfx-social-icons-diamond *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}The same effect using Tailwind utility classes. No custom CSS or config needed.
<ul class="flex gap-5">
<li>
<a href="#" aria-label="Email" class="group grid h-9 w-9 rotate-45 place-items-center rounded-lg border-2 border-blue-500 text-blue-500 transition duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:rotate-0 hover:bg-blue-500 hover:text-white">
<svg class="h-[18px] w-[18px] -rotate-45 transition-transform duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] group-hover:rotate-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3.5 7 8.5 6 8.5-6"/></svg>
</a>
</li>
<li>
<a href="#" aria-label="Share" class="group grid h-9 w-9 rotate-45 place-items-center rounded-lg border-2 border-blue-500 text-blue-500 transition duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:rotate-0 hover:bg-blue-500 hover:text-white">
<svg class="h-[18px] w-[18px] -rotate-45 transition-transform duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] group-hover:rotate-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="m8.6 13.5 6.8 4M15.4 6.5l-6.8 4"/></svg>
</a>
</li>
<li>
<a href="#" aria-label="Chat" class="group grid h-9 w-9 rotate-45 place-items-center rounded-lg border-2 border-blue-500 text-blue-500 transition duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:rotate-0 hover:bg-blue-500 hover:text-white">
<svg class="h-[18px] w-[18px] -rotate-45 transition-transform duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] group-hover:rotate-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.4 8.4 0 0 1-12.2 7.5L3 21l2-5.3A8.5 8.5 0 1 1 21 11.5Z"/></svg>
</a>
</li>
<li>
<a href="#" aria-label="Website" class="group grid h-9 w-9 rotate-45 place-items-center rounded-lg border-2 border-blue-500 text-blue-500 transition duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:rotate-0 hover:bg-blue-500 hover:text-white">
<svg class="h-[18px] w-[18px] -rotate-45 transition-transform duration-500 ease-[cubic-bezier(0.34,1.56,0.64,1)] group-hover:rotate-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9.5"/><path d="M2.5 12h19M12 2.5c2.6 2.6 3.8 5.8 3.8 9.5s-1.2 6.9-3.8 9.5c-2.6-2.6-3.8-5.8-3.8-9.5s1.2-6.9 3.8-9.5Z"/></svg>
</a>
</li>
</ul>--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.