Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<html lang="ja">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Button Example</title>
body {
display: flex;
justify-content: center;
flex-direction: column;
height: 100vh;
body > div {
margin: 8px auto;
button {
background-color: #03a9f4;
color: #fff;
border: none;
font-size: 32px;
margin: 0;
padding: 8px 24px;
border-radius: 32px;
cursor: pointer;
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
button:hover {
background-color: #2196f3;
button:active {
background-color: #2b82c7;
outline: none;
button:disabled {
background-color: #bbbbbb;
cursor: default;
button:focus {
outline: none;
label {
font-size: 24px;
function toggle() {
const button = document.getElementsByTagName('button')[0];
button.disabled = !button.disabled;
<button ontouchstart="">ボタン</button>
<input type="checkbox" onclick="toggle()">ボタン無効化
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment