Objectives

  • Set up a modern blog using Astro and Sanity CMS
  • Use Astro’s blog template for built-in SEO and RSS features
  • Customize site layouts and global styles using CSS
  • Implement responsive full-screen background images and ornate borders
  • Create pixel-perfect hover effects for transparent icons using JavaScript
  • Build a zoom-immune, responsive layout using viewport units

Instructions

  1. Install Node.js from the official website and a code editor like VS Code.
  2. Open your terminal and run the command npm create astro@latest.
  3. Select the “Use blog template” option when prompted by the setup wizard.
  4. Navigate into your project folder and run npm run dev to launch the local server.
  5. Add new blog posts by creating Markdown (.md) files in the src/content/blog/ directory.
  6. Modify src/styles/global.css to change the site’s background color or global font settings.
  7. Set a full-screen background image by applying background-size: cover to the body tag.
    • Use .jpg or .webp formats instead of .png to maintain fast loading speeds.
  8. Create an ornate, responsive frame using the border-image property with 9-slice scaling.
    • Ensure the border-image-slice value matches the pixel size of the corners in your image file.
  9. Use the box-sizing: border-box property to prevent borders and padding from causing unwanted scrollbars.
  10. Build a PixelLink.astro component using HTML5 Canvas to detect mouse hovers on non-transparent pixels only.
  11. Organize icons in a container using display: flex, flex-direction: column, and flex-wrap: wrap.
  12. Set align-content: flex-end to ensure new columns wrap inward toward the left side of the screen.
  13. Replace fixed pixel values (px) with viewport units (vh and vw) to make the UI “zoom-immune.”
    • Define icon heights in vh so they scale proportionally with the browser zoom level.