Skip to content

Instantly share code, notes, and snippets.

@welblaud
Created December 15, 2021 16:09
Show Gist options
  • Save welblaud/3f04666198c3a779403d024447172563 to your computer and use it in GitHub Desktop.
Save welblaud/3f04666198c3a779403d024447172563 to your computer and use it in GitHub Desktop.
<style>
form {
position: relative;
width: 240px;
margin: 16px;
}
input {
width: 100%;
padding: 2px 24px 2px 2px;
box-sizing: border-box;
}
button {
margin-top: 3px;
margin-right: 3px;
border-radius: 50%;
border-style:none;
}
.wrapper {
position: absolute;
right: 0;
top: 0;
bottom: 0;
}
input:not(:valid)+.wrapper {
display: none;
}
</style>
<form>
<input type="text" required>
<div class="wrapper">
<button type="reset" tabindex="-1" aria-label="Reset">
&times;
</button>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment