Skip to content

Instantly share code, notes, and snippets.

@igayamaguchi
Created March 21, 2020 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igayamaguchi/f4c7e0261362c404ff1c77bfe4387932 to your computer and use it in GitHub Desktop.
Save igayamaguchi/f4c7e0261362c404ff1c77bfe4387932 to your computer and use it in GitHub Desktop.
<!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