Last active
November 28, 2018 11:38
-
-
Save nshun/0547fe5a9a6c1fe66944ed4692e045e7 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
.tab { | |
overflow: hidden; | |
} | |
.tab > input { | |
display: none; | |
} | |
.tab nav label { | |
display: inline-block; | |
color: #0090C8; | |
background-color: #fff; | |
border-radius: 6px 6px 0 0; | |
padding: 3px 10px; | |
transition: 0.3s; | |
} | |
.tab > div { | |
display: flex; | |
width: 200%; | |
} | |
.tab section { | |
width: 100%; | |
padding: 0.5em 0.75em; | |
border: 1px solid #0075c2; | |
border-radius: 0 6px 6px 6px; | |
box-sizing: border-box; | |
} | |
.tab input[id="tab1"]:checked ~ div { | |
transform: translateX(0); | |
} | |
.tab input[id="tab2"]:checked ~ div { | |
transform: translateX(-50%); | |
} | |
.tab input[id="tab1"]:checked ~ nav label[for="tab1"] { | |
color: #fff; | |
background-color: #0090C8; | |
} | |
.tab input[id="tab2"]:checked ~ nav label[for="tab2"] { | |
color: #fff; | |
background-color: #0090C8; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="tab"> | |
<input type="radio" name="radiotabs" id="tab1" checked> | |
<input type="radio" name="radiotabs" id="tab2"> | |
<nav> | |
<label for="tab1">Windows</label> | |
<label for="tab2">Mac</label> | |
</nav> | |
<div> | |
<section> | |
win content | |
</section> | |
<section> | |
mac content | |
<br>this has more content | |
<br>this has more content | |
<br>this has more content | |
</section> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment