This page demonstrates the difference between Media Queries and Container Queries. It was built with Svelte and hosted on Vercel.
The page contains two containers:
- Media Queries Container: This container changes its layout based on the width of the viewport.
- Container Queries Container: This container changes its layout based on the width of the container.
A slider allows the user to change the width of the container and observe the differences between the two approaches.
-
Media Queries:
- Change the layout based on the width of the viewport.
- Useful for global layout changes.
-
Container Queries:
- Change the layout based on the width of the container.
- Useful for components that need to adapt dynamically.
The page was built using the Svelte framework. Svelte is a modern JavaScript framework for building reactive user interfaces.
The page is hosted on Vercel. Vercel is a platform for hosting static sites and serverless functions.
This is the main file of the page. It contains the HTML, CSS, and JavaScript code that defines the page.
The HTML part of the file contains the structure of the page, including the two containers and the slider.
The CSS part of the file contains the styles for the page, including the Media Queries and Container Queries.
The JavaScript part of the file contains the logic for the slider that changes the width of the container.