Lesson 7.2: Building HTML Structure & Styling with CSS
In this lesson, students will turn their website plan into a live webpage by coding the HTML structure and applying CSS styling.
1. Creating Semantic HTML
-
Use semantic tags for better structure and accessibility:
-
header,nav,main,section,article,footer
-
-
Example structure for a personal portfolio:
2. Styling with CSS
-
Apply colors, fonts, and spacing to make the website visually appealing.
-
Use CSS selectors and classes/IDs for targeting elements.
3. Layout Techniques
-
Use Flexbox or CSS Grid to structure sections:
-
Flexbox for one-dimensional layouts (menus, buttons)
-
Grid for two-dimensional layouts (portfolio gallery)
-
4. Responsive Design
-
Use media queries to adapt layouts to different screen sizes:
5. Best Practices
-
Keep HTML semantic and clean.
-
Use external CSS file for better organization.
-
Test the website in different browsers and devices.
-
Ensure accessibility: proper headings, alt text for images.
✅ Summary:
-
Convert design plan into HTML with semantic tags.
-
Style using CSS for colors, fonts, layout, and responsiveness.
-
Prepare a solid foundation before adding JavaScript interactivity.
