Advanced HTML & CSS
Prompt
Create advanced HTML and CSS code for a website with specific structural requirements. Consider modern web development practices to ensure code quality, responsiveness, and accessibility. # Steps 1. **Understand Requirements**: Determine the structural and design elements that should be included (e.g., header, footer, navigation, main content areas). 2. **Research Best Practices**: Review current trends in HTML5 and CSS3 to ensure the website is modern and efficient. 3. **Code the HTML Layout**: Organize the content logically using semantic elements like `<header>`, `<nav>`, `<main>`, `<article>`, and `<footer>`. 4. **Style Using CSS**: Use advanced CSS techniques such as Flexbox or Grid for layout, and ensure styles are responsive using media queries. 5. **Ensure Accessibility**: Include ARIA roles and attributes to improve accessibility. 6. **Test Across Devices**: Make sure the site is responsive and displays correctly on various devices and browsers. # Output Format - Provide the HTML code, followed by the CSS code. - Include comments explaining any complex sections. # Examples **HTML Example:** ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Advanced Website</title> <link rel="stylesheet" href="styles.css"> </head> <body> <header> <h1>Website Title</h1> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> </header> <main> <section> <h2>Main Content</h2> <p>This is the main content area.</p> </section> </main> <footer> <p>© 2023 Your Name. All rights reserved.</p> </footer> </body> </html> ``` **CSS Example:** ```css body { font-family: Arial, sans-serif; line-height: 1.6; margin: 0; padding: 0; } header, footer { background-color: #f8f9fa; padding: 1rem; text-align: center; } nav ul { list-style: none; padding: 0; } nav ul li { display: inline; margin-right: 10px; } main { margin: 2rem; } @media (max-width: 600px) { nav ul li { display: block; margin: 0; } } ``` # Notes - Emphasize responsive design and cross-browser compatibility. - Keep the code organized and well-commented for ease of understanding and maintenance. - Use a cohesive color scheme and typography that enhances readability and aesthetics.
Related Coding Prompts
Write Code
As a seasoned programmer, your task is to write code in [programming language] to [perform action]. The code should be efficient, well-structured, and optimized for performance. Make sure to follow best practices and industry standards while implementing the necessary algorithms and logic to achieve the desired functionality. Test the code thoroughly to ensure it functions as intended and meets all requirements. Additionally, document the code properly for future reference and maintenance.
Debug Code
Act as a seasoned programmer with over 20 years of commercial experience. Analyze the provided [piece of code] that is causing a specific [error]. Your task involves diagnosing the root cause of the error, understanding the context and functionality intended by the code, and proposing a solution to fix the issue. Your analysis should include a step-by-step walkthrough of the code, identification of any bugs or logical mistakes, and a detailed explanation of how to resolve them. Additionally, suggest any improvements or optimizations to enhance the performance, readability, or maintainability of the code based on your extensive experience. Ensure that your solution adheres to best practices in software development and is compatible with the current development environment where the code is being executed.
Do Code Review
As a seasoned programmer with over 20 years of commercial experience, your task is to perform a comprehensive code review on the provided [piece of code]. Your review should meticulously evaluate the code's efficiency, readability, and maintainability. You are expected to identify any potential bugs, security vulnerabilities, or performance issues and suggest specific improvements or optimizations. Additionally, assess the code's adherence to industry standards and best practices. Your feedback should be constructive and detailed, offering clear explanations and recommendations for changes. Where applicable, provide examples or references to support your suggestions. Your goal is to ensure that the code not only functions as intended but also meets high standards of quality and can be easily managed and scaled in the future. This review is an opportunity to mentor and guide less experienced developers, so your insights should be both educational and actionable.