Waffle Site in TailwindCSS - Header (11-30-2026) | CIS311
Overview
Kenan Casey begins recreating the Snack'n Waffles Wildberry product page for a CIS311 final project, explaining how Tailwind CSS turns utility classes and theme variables into a generated stylesheet. He then builds the responsive header with an SVG sprite menu icon, a fixed purple bar, a centered logo, and mobile-versus-desktop navigation visibility.
Key takeaways
- Tailwind's build process scans the project for utility classes and writes the required CSS to dist/output.css, so the generated stylesheet must be linked from index.html.
- Running npm run dev keeps Tailwind in watch mode and automatically refreshes generated CSS as classes change.
- An SVG sprite lets a page define icons once as symbols and reuse them through SVG use elements that reference symbol IDs.
- The combination of left-1/2 and -translate-x-1/2 centers an absolutely positioned element by aligning its midpoint with the midpoint of its containing area.
- Responsive utility pairs such as lg:hidden and hidden lg:block provide a straightforward way to swap mobile and desktop navigation at Tailwind's LG breakpoint.
Chapters
- The final project recreates the Snack'n Waffles Wildberry product page, which has roughly five or six sections.
- The main working files are index.html and source/input.css; the provided Tailwind theme defines brand colors, fonts, and the hero background image.
- The custom purple is #685BC7, exposed through Tailwind's theme so it can be used as a utility such as text-purple.
- Node.js and npm manage the project's development tools, including Tailwind CSS and the Tailwind CLI listed in package.json.
- Running npm install from the directory containing package.json installs the dependencies into node_modules.
- Tailwind CLI processes source/input.css and the classes used in the project to generate dist/output.css, which index.html includes.
- The npm run dev script runs Tailwind in watch mode, regenerating dist/output.css when project files change.
- A one-time CLI run generated 366 lines of CSS, including the rules needed for the page's white background and purple text.
- Keeping npm run dev active during development avoids manually rerunning the Tailwind build command after each class change.
- A hidden, zero-sized SVG near the top of the HTML stores reusable symbol definitions such as icon-menu and icon-star.
- The header renders a symbol by placing an SVG use element inside an SVG and referencing the symbol ID with an href such as #icon-menu.
- The shared icon utility in input.css sets dimensions and SVG stroke properties, allowing each icon to use a concise icon class.
- The original site's header stays visible while scrolling, so the recreated header uses fixed positioning and inset utilities to span the viewport.
- A custom --header-height variable controls header height, with a larger value at the XL breakpoint; Tailwind can reference it through an arbitrary value such as h-(--header-height).
- Applying flex and items-center vertically aligns the menu control within the header.
- The centered Snack'n Waffles logo is an image inside an anchor, positioned with left-1/2 and -translate-x-1/2 to center it by its own width.
- The logo uses the white logo asset from assets/images, while the header is fixed across the viewport.
- Wrapping the SVG menu icon in a button makes it an interactive control; grid, place-items-center, and text sizing help set its size and alignment.
- The mobile menu button is hidden at the LG breakpoint and above, using the responsive utility lg:hidden.
- The desktop navigation follows the inverse pattern: hidden by default, then displayed at LG and above.
- The header is the starting point for the recreation; the next class session will continue with mobile layout, a more difficult page section, and parallax, while the image slider is treated as a stretch goal.
Transcript excerpt
0:00 But this is the website we're making for our final exam. Final project is the Snack and Waffles Wild Blueberry product page. As we've seen, it's got these five or six sections. What I gave you is this. And I've got a If you look under there's an index.html. You got an index. And under source, I hope you have an input.css. And I hope you don't have an input completed. Do you have an input completed?
0:48 Okay. So those are the main two files that we're going to use. This is a Well, in order to use Tailwind effectively, we need a little bit of a build system for this app. So I wanted to give you this structure up front or build system for this site. That is when we write Tailwind. So when I come down here and say, hey, this body has a class that has a BG of white. So I made the background white and I made the text color purple, say. What needs to happen is that those two
1:38 CSS classes need to be written and put in a CSS file that's actually accessed by our site. If you hover over this just did it. There you go. You see what this what CSS is actually going to be written for this. So this BG white class is going to have a color of a var dash dash color white. And the text purple is going to create this purple color. Okay? So the way Tailwind works, the way we're going to use it here is we're going to create an input CSS file and we're going to write CSS classes throughout our code.
2:28 Um this is the input CSS file. I went ahead and gave you this. You see you input import
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Kenan Casey.