Coding task · HTML and CSS course · Module 5: Responsiveness
Media query for tablet
Media queries are QUERIES to the device: 'What screen size do you have?' - like an Egyptian architect asking 'How much space do we have?' before building. Syntax: @media (condition) { styles }. Main breakpoints: mobile (up to 767px), tablet (768px-1023px), desktop (1024px+). We use min-width (from this width) or max-width (up to this width). You can combine them: @media (min-width: 768px) and (max-width: 1024px). It's like building a temple adapted to the terrain!
Task
Create a responsive container for tablet using a media query. HTML: <div class='container'>Temple on tablet</div>. Base CSS: .container {width: 100%; background: #F4E4C1; padding: 20px;}. Then add @media (min-width: 768px) and (max-width: 1024px) { .container {width: 90%; margin: 0 auto; background: #FFD700; font-size: 20px; border: 3px solid #8B4513;} }. Test by resizing the window - watch how the style changes on tablet!