Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Button Example</title>
<style>
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;
}
</style>
<script>
function toggle() {
const button = document.getElementsByTagName('button')[0];
button.disabled = !button.disabled;
}
</script>
</head>
<body>
<div>
<button ontouchstart="">ボタン</button>
</div>
<div>
<label>
<input type="checkbox" onclick="toggle()">ボタン無効化
</label>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment