35 lines
1.1 KiB
HTML
35 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<title>Breakpoints & Media Queries</title>
|
|
</head>
|
|
<!-- Tailwind is mobile-first -->
|
|
<body
|
|
class="bg-black sm:bg-green-800 md:bg-blue-800 lg:bg-yellow-800 xl:bg-purple-800 2xl:bg-red-800"
|
|
>
|
|
<h1 class="text-white text-4xl md:text-3xl"></h1>
|
|
<script>
|
|
function showBrowserWidth() {
|
|
const width = window.innerWidth;
|
|
|
|
document.querySelector("h1").innerText = `Width: ${width}px`;
|
|
}
|
|
|
|
window.onload = showBrowserWidth;
|
|
window.onresize = showBrowserWidth;
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|
|
<!-- Breakpoint Classes
|
|
sm 640px @media (min-width: 640px) { ... }
|
|
md 768px @media (min-width: 768px) { ... }
|
|
lg 1024px @media (min-width: 1024px) { ... }
|
|
xl 1280px @media (min-width: 1280px) { ... }
|
|
2xl 1536px @media (min-width: 1536px) { ... }
|
|
-->
|