static
is the default utility for position. That’s why we seldom use static
in a practical project.
Version
TailwindCSS 3.0
Flow
A
, B
, C
are displayed by HTML position.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>TailwindCSS</title>
</head>
<body>
<div>A</div>
<div>B</div>
<div>C</div>
</body>
</html>
Line 10
<div>A</div>
<div>B</div>
<div>C</div>
Normal HTML is displayed by HTML positon.
static
B
is static
, but it’s no different from flow layout.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>TailwindCSS</title>
</head>
<body>
<div>A</div>
<div class="static">B</div>
<div>C</div>
</body>
</html>
Line 10
<div>A</div>
<div class="static">B</div>
<div>C</div>
static
: use static position
Since every element is
static
by default, we don’t have to usestatic
for position
Conclusion
- We can’t add
top
,bottom
,left
orright
to specify the location forstatic
. This is the main difference betweenstatic
andabsolute
,relative
,fixed
,sticky