-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-title-animation.html
More file actions
140 lines (138 loc) · 4.58 KB
/
data-title-animation.html
File metadata and controls
140 lines (138 loc) · 4.58 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="CSS animations" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CSS animations</title>
<link rel="stylesheet" href="css/main.min.css" />
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
<link rel="manifest" href="site.webmanifest" />
</head>
<body>
<div id="loader" aria-hidden="true">Loading...</div>
<input type="checkbox" id="theme" aria-label="theme" title="Theme" />
<label for="theme" id="theme-label">Theme</label>
<!--[if lt IE 8]>
<p class="browsehappy">
You are using an
<strong>outdated</strong>
browser. Please
<a href="#">upgrade your browser</a>
to improve your experience.
</p>
<![endif]-->
<div id="wrapper">
<a id="top"></a>
<header id="header">
<a href="/">
<span>daug.eu</span>
<span id="logo"></span>
</a>
</header>
<button class="toggle-btn" id="menu">menu</button>
<div class="nav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="tetris-animation.html">tetris animation</a></li>
<li><a href="spining-dots-animation.html">spinning dots animation</a></li>
<li><a href="loader3d-animation.html">loader3d animation</a></li>
<li><a href="Lithuania-animation.html">Lithuania animation</a></li>
<li><a href="cassette-animation.html">cassette animation</a></li>
<li><a href="box3d-animation.html">box3d animation</a></li>
<li><a href="scale-animation.html">scale animation</a></li>
<li><a href="numbers-animation.html">numbers animation</a></li>
<li><a href="loader-animation.html">loader animation</a></li>
<li><a href="data-title-animation.html">data attribute animation</a></li>
<li><a href="speaker-animation.html">speaker animation</a></li>
<li><a href="kitty-animation.html">kitty animation</a></li>
<li><a href="digital-text-animation.html">digital text animation</a></li>
<li><a href="svg-animation.html">svg animation</a></li>
</ul>
</div>
<main class="container">
<article>
<h1 class="title">data attribute animation</h1>
<div class="block">
<h2>HTML</h2>
<div class="box code">
<pre>
<div class="box" data-title="YUP YUP DIV DIV DIV">
I'm a div with a data-title attribute
</div></pre
>
</div>
</div>
<div class="block">
<h2>CSS</h2>
<div class="box code">
<pre>
[data-title] {
position: relative;
cursor: pointer;
}
[data-title]::after, [data-title]::before {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0;
}
[data-title]::after {
content: attr(data-title);
bottom: 120%;
background: rgba(0, 0, 0, 0.7);
color: #aaa;
font-size: 0.625em;
text-align: center;
white-space: nowrap;
padding: 10px;
border-radius: 24px;
min-height: 24px;
min-width: 140px;
max-width: 240px;
display: grid;
align-items: center;
pointer-events: none;
transition: opacity 0.3s ease-in-out;
filter: drop-shadow(0 0 1px #aaa) drop-shadow(0 20px 6px rgba(0, 0, 0, 0.5));
z-index: 10;
}
[data-title]::before {
content: "";
bottom: calc(120% - 8px);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid rgba(0, 0, 0, 0.7);
transition: opacity 0.2s ease-in-out;
}
[data-title]:hover::after, [data-title]:hover::before {
opacity: 1;
}
</pre
>
</div>
</div>
</article>
<aside>
<div class="block">
<h2>Animation</h2>
<div class="box" style="cursor: pointer">
<div class="box" data-title="YUP YUP DIV DIV DIV">
I'm a div with a data-title attribute
</div>
</div>
</div>
</aside>
</main>
<footer>
<p>2023 by Kostas Šliažas</p>
</footer>
<a href="#top" id="totop">Back to top</a>
</div>
<script src="js/gall.min.js" defer></script>
<script src="js/script.min.js" defer></script>
</body>
</html>