-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSS-Tab.html
More file actions
69 lines (69 loc) · 1.19 KB
/
Copy pathCSS-Tab.html
File metadata and controls
69 lines (69 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<html>
<head>
<title>CSS-Tab</title>
<style>
.tabs{
position: relative;
margin: 0;
padding: 15px;
}
.tab{
display: inline-block;
margin-right: 1px;
list-style-type: none;
font-size: 14px;
}
.tab:last-child{
margin-right: 0;
}
.tab a{
display: block;
padding: 10px 15px;
background: rgba(0,0,0,0.3);
text-decoration: none;
transition: all 0.5s ease;
}
.tab:target a{
background: rgba(0,0,0,0.1);
}
.tab a + .tab-content{
position: absolute;
left: 0;
height: 0;
padding: 0 15px;
overflow: hidden;
transition: all 0.1s ease;
}
.tab:target a + .tab-content{
height: 100%;
overflow: visible;
transition: all 0.5s ease;
}
</style>
</head>
<body>
<ul class="tabs">
<li id="tab1" class='tab'>
<a href="#tab1">Tab 1</a>
<div class="tab-content">
<h2>Heading 1</h2>
<p>Content 1</p>
</div>
</li>
<li id="tab2" class='tab'>
<a href="#tab2">Tab 2</a>
<div class="tab-content">
<h2>Heading 2</h2>
<p>Content 2</p>
</div>
</li>
<li id="tab3" class='tab'>
<a href="#tab3">Tab 3</a>
<div class="tab-content">
<h2>Heading 3</h2>
<p>Content 3</p>
</div>
</li>
</ul>
</body>
</html>