Last active
December 19, 2017 02:16
-
-
Save okuden-labo/1449195736f6cbf95b6cdb047628c1fa to your computer and use it in GitHub Desktop.
:target疑似クラスを使って、コンテンツを表示・非表示することで、簡易版の開閉パネルを作成。 参考サイト:http://coliss.com/articles/build-websites/operation/css/target-pseudo-class-trick.html
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
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>:target疑似クラスを使って、コンテンツを表示・非表示</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<style> | |
#comments { | |
padding-top: 70px; | |
} | |
#comments:not(:target) { | |
display: none; | |
} | |
#comments:target { | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrapper body-wrapper"> | |
<h1>簡易版の開閉パネル</h1> | |
<p>:target疑似クラスを使って、コンテンツを表示・非表示することで、簡易版の開閉パネルになる</p> | |
<a href="#comments">Show Comments</a> | |
<section id="comments"> | |
<h3>Comments</h3> | |
<p>ここは隠れている部分のコンテンツです。</p> | |
<a href="#">Hide Comments</a> | |
</section> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment