Designing a responsive layout for a societal application
Aim
To design a responsive layout for a societal application that adapts to all device sizes—desktop, tablet, and mobile—using HTML and CSS.
Algorithm/Procedure
-
Define Purpose and Audience:
-
Determine the goal of the application (e.g., information/resource sharing, community updates).
-
-
Set Breakpoints:
-
Identify major screen sizes (mobile, tablet, desktop).
-
-
Create Layout Using Fluid Grids & Flexbox:
-
Use percentage widths and Flexbox for flexible layouts.
-
-
Design Navigation:
-
Create a navigation bar that reorganizes for smaller screens.
-
-
Use Responsive Components:
-
Sections/content adapt and reorder for every device.
-
-
Apply Media Queries:
-
Use CSS media queries to adjust styles at defined breakpoints.
-
-
Test and Iterate:
-
View on multiple devices, adjust as needed for usability.
-
Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Responsive Societal Application</title> <style> body { margin: 0; font-family: Arial, sans-serif; background: #f9f9f9; } header { background: #009688; color: white; padding: 2rem; text-align: center; } nav ul { display: flex; flex-wrap: wrap; background: #eee; padding: 0; margin: 0; list-style: none; justify-content: center; } nav ul li { margin: 1rem 2rem; } nav ul li a { text-decoration: none; color: #009688; font-weight: bold; } main { display: flex; flex-wrap: wrap; padding: 2rem; gap: 2rem; justify-content: center; } section { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 2rem; border-radius: 8px; min-width: 250px; max-width: 450px; flex: 1 1 350px; } footer { text-align: center; background: #009688; color: white; padding: 1rem; margin-top: 2rem; } @media (max-width: 700px) { main { flex-direction: column; padding: 1rem; } section { margin: 0 auto 1rem auto; } } </style> </head> <body> <header> <h1>Societal Application - Responsive Layout</h1> </header> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Community</a></li> <li><a href="#">Contact</a></li> </ul> </nav> <main> <section> <h2>Services</h2> <p>Access health, safety, and education services anytime, anywhere.</p> </section> <section> <h2>Community News</h2> <p>Stay updated with the latest news affecting your neighborhood.</p> </section> <section> <h2>Resources</h2> <p>Find government schemes, jobs, and support programs.</p> </section> </main> <footer> © 2025 Societal Application. All rights reserved. </footer> </body> </html>
Join the conversation