CSS Language Select
A compact language switcher: a native select with a globe icon on the left and a chevron on the right.
<label class="lang-select">
<span class="lang-select-sr">Language</span>
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/></svg>
<select name="lang">
<option value="en" selected>English</option>
<option value="de">Deutsch</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
</select>
</label>
.lang-select {
position: relative;
display: inline-block;
font-family: system-ui, sans-serif;
}
.lang-select-sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.lang-select svg {
position: absolute;
top: 50%;
left: 12px;
width: 16px;
height: 16px;
fill: none;
stroke: #94a3b8;
stroke-width: 2;
transform: translateY(-50%);
pointer-events: none;
}
.lang-select select {
padding: 8px 32px 8px 36px;
border: 1px solid #334155;
border-radius: 999px;
background: #1e293b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
color: #e2e8f0;
font: 500 14px system-ui, sans-serif;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
.lang-select select:hover {
border-color: #475569;
}
.lang-select select:focus-visible {
outline: 2px solid #38bdf8;
outline-offset: 2px;
}
.lang-select option {
background: #1e293b;
color: #e2e8f0;
}
About this CSS Language Select
This CSS Language Select is 53 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses transforms, clip paths and keyboard focus styles. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#94a3b8#334155#1e293b#e2e8f0#475569#38bdf8
How to use this language select
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.lang-selectclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.