Created
March 9, 2021 08:23
-
-
Save amane-katagiri/d52284d464386bdfdac8be109c5d4534 to your computer and use it in GitHub Desktop.
チェックボックスでスタイルを切り替える
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>チェックボックスでスタイルを切り替える</title> | |
<style> | |
#main { | |
background-color: red; | |
} | |
input[type="checkbox"]#toggle:checked ~ #main { | |
color: #eee; | |
background-color: blue; | |
} | |
</style> | |
</head> | |
<body> | |
<input id="toggle" type="checkbox"> | |
<section id="main"> | |
<div>チェックボックスでスタイルを切り替える</div> | |
</section> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment