` with the class `nav-links`. src/components/Navigation.astro ```diff --- ---
``` 2. Copy the CSS styles below into `global.css`. These styles: * Style and position the navigation links for mobile * Include an `expanded` class that can be toggled to display or hide the links on mobile * Use a `@media` query to define different styles for larger screen sizes src/styles/global.css ```diff html { background-color: #f1f5f9; font-family: sans-serif; } body { margin: 0 auto; width: 100%; max-width: 80ch; padding: 1rem; line-height: 1.5; } * { box-sizing: border-box; } h1 { margin: 1rem 0; font-size: 2.5rem; } +/* nav styles */ +.nav-links { +width: 100%; +top: 5rem; +left: 48px; +background-color: #ff9776; +display: none; +margin: 0; +} +.nav-links a { +display: block; +text-align: center; +padding: 10px 0; +text-decoration: none; +font-size: 1.2rem; +font-weight: bold; +text-transform: uppercase; +} +.nav-links a:hover, +.nav-links a:focus { +background-color: #ff9776; +} +.expanded { +display: unset; +} +@media screen and (min-width: 636px) { +.nav-links { +margin-left: 5em; +display: block; +position: static; +width: auto; +background: none; + } +.nav-links a { +display: inline-block; +padding: 15px 20px; + } +} ``` Resize your window and look for different styles being applied at different screen widths. Your header is now **responsive** to screen size through the use of `@media` queries. ## Checklist [Section titled “Checklist”](#checklist) * I can use CSS to add responsive elements to my site. ### Resources [Section titled “Resources”](#resources) * [Component-based Design](https://www.droptica.com/blog/component-based-design/) external * [Semantic HTML Tags](https://www.dofactory.com/html/semantics) external * [Mobile-first Design](https://www.mobileapps.com/blog/mobile-first-design) external
# Send your first script to the browser
> Tutorial: Build your first Astro blog —
Add client-side interactivity to your mobile navigation with an Astro script tag
Let’s add a hamburger menu to open and close your links on mobile screen sizes, requiring some client-side interactivity! Get ready to… * Create a hamburger menu component * Write a ` ``` 2. Check your browser preview again at various sizes, and verify that you have a working navigation menu that is both responsive to screen size and responds to user input on this page. ### Importing a `.js` file [Section titled “Importing a .js file”](#importing-a-js-file) Instead of writing your JavaScript directly on each page, you can move the contents of your ` ``` 3. Check your browser preview again at a smaller size and verify that the hamburger menu still opens and closes your navigation links. 4. Add the same `