Open this example in the interactive library
Source code
<style>
.demo:focus {
background-color: #dbeafe;
}
</style>
<input
class="demo"
aria-label="Focus example"
value="Click or tab into the field"
/>
Style focus independently of keyboard modality with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo:focus {
background-color: #dbeafe;
}
</style>
<input
class="demo"
aria-label="Focus example"
value="Click or tab into the field"
/>