LLM Prompts

Mastering CSS Grid and Flexbox: A Comprehensive Guide

Generate CSS grid and flexbox layouts for various web design scenarios.

The method

Use these prompts by pasting them directly into ChatGPT/Gemini/Claude. Adapt the grid/flexbox parameters to fit your specific layout requirements. Experiment with different values for rows, columns, and alignment properties.

The prompts

Prompt 1
I need to create a responsive website layout using CSS Grid. The layout should have a header, a sidebar, a main content area, and a footer. The header and footer should span the entire width of the page, while the sidebar should take up 25% of the width and the main content area should take up the remaining 75%. The layout should adapt to different screen sizes, with the sidebar moving below the main content area on smaller screens. Please generate the necessary CSS Grid code, including media queries for responsiveness. Also, provide comments explaining each part of the code and suggestions for improving the design.
Prompt 2
Generate CSS Flexbox code to create a navigation bar with the following features: The navigation bar should be horizontally aligned. The navigation items should be evenly spaced. On smaller screens, the navigation items should wrap to multiple lines if necessary. The navigation bar should have a background color and the navigation items should have a hover effect. Please provide the complete CSS code for the navigation bar, including any necessary HTML markup. Add styling for active and visited links. Suggest best practices for accessibility when using Flexbox for navigation menus.
Prompt 3
Simulate a real-world project scenario: A client requires a product gallery using CSS Grid. The gallery should display product images in a grid layout with 3 columns on larger screens and 2 columns on smaller screens. Each product image should have a title and a short description. On hover, the product image should zoom in slightly and the title and description should become visible. Write the CSS Grid and HTML code to implement this product gallery, ensuring it is visually appealing and user-friendly. Optimize the code for performance and SEO. Consider lazy loading images for improved loading times and provide the final code in one block.