Creating a Responsive Online Quran Learning Website with HTML and CSS
Educational websites have a clear job: help a visitor understand what is offered, trust the people offering it, and take one next step. In this article I'll walk through how to structure a responsive homepage for an online Quran learning academy using nothing but semantic HTML and modern CSS — no framework.
We'll build five sections:
- A sticky header with a mobile-friendly nav
- A hero with a two-column layout that stacks on mobile
- A course card grid
- Teacher profile cards
- A trial-class information panel
Design tokens first
Before writing layout code, I define the palette and spacing as custom properties. Changing the theme later becomes a one-line edit.
:root {
--green: #073d2e;
--green-2: #0b5942;
--gold: #d5ae59;
--cream: #fbf8ef;
--ink: #17372d;
--muted: #687a71;
--line: #e8e7df;
--radius: 18px;
--shadow: 0 14px 38px rgba(4, 42, 31, .12);
}
*, *::before, *::after { box-sizing: border-box; }
body {
margin: 0;
background: var(--cream);
color: var(--ink);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
line-height: 1.6;
}
.container { max-width: 1140px; margin-inline: auto; padding-inline: 20px; }
Deep green and warm gold feel calm and traditional without being heavy, and both pass contrast checks against cream and white.
1. Sticky header
<header class="site-header">
<nav class="container nav" aria-label="Main">
<a href="/" class="brand">Quran Academy</a>
<button class="nav-toggle" aria-expanded="false" aria-controls="nav-links">Menu</button>
<ul id="nav-links" class="nav-links">
<li><a href="#courses">Courses</a></li>
<li><a href="#teachers">Teachers</a></li>
<li><a href="#trial">Free trial</a></li>
</ul>
</nav>
</header>
.site-header { position: sticky; top: 0; z-index: 10; background: var(--green); color: #fff; }
.nav { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.nav-links { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: #fff; text-decoration: none; }
.nav-toggle { display: none; }
@media (max-width: 760px) {
.nav-toggle { display: inline-block; }
.nav-links { display: none; position: absolute; inset: 100% 0 auto; flex-direction: column;
background: var(--green); padding: 16px 20px; }
.nav-links.open { display: flex; }
}
const toggle = document.querySelector('.nav-toggle');
const links = document.getElementById('nav-links');
toggle.addEventListener('click', () => {
const open = links.classList.toggle('open');
toggle.setAttribute('aria-expanded', open);
});
aria-expanded keeps screen readers informed of the menu state — an easy detail to forget.
2. The hero
The hero has one headline, one supporting sentence and one primary action. On desktop it sits beside a summary card; on mobile it stacks.
.hero { background: var(--green); color: #fff; padding: 64px 0; }
.hero-grid {
display: grid;
grid-template-columns: 1.15fr .85fr;
gap: 48px;
align-items: center;
}
.hero h1 { font-family: Georgia, serif; font-size: clamp(32px, 5vw, 54px); line-height: 1.1; margin: 0 0 16px; }
@media (max-width: 860px) {
.hero-grid { grid-template-columns: 1fr; }
}
clamp() scales the headline smoothly between phone and desktop without a stack of breakpoints.
3. Course cards
Courses like Noorani Qaida, Quran Reading, Tajweed, Makhariij and Hifz suit a card grid. auto-fit + minmax() produces three columns on desktop, two on tablet and one on phone automatically.
<section id="courses" class="container">
<h2>Courses</h2>
<div class="cards">
<article class="card">
<h3>Noorani Qaida</h3>
<p>Letters, vowels and joining — the foundation for reading.</p>
</article>
<!-- more cards -->
</div>
</section>
.cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
gap: 18px;
}
.card {
background: #fff;
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 22px;
transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
@media (prefers-reduced-motion: reduce) {
.card { transition: none; }
.card:hover { transform: none; }
}
Respecting prefers-reduced-motion is a small touch that matters to users sensitive to animation.
4. Teacher profiles
Trust is central for parents choosing a teacher. Each profile shows a photo (or initials fallback), qualifications and languages.
<article class="teacher">
<div class="avatar" aria-hidden="true">AK</div>
<div>
<h3>Teacher name</h3>
<p class="meta">Tajweed · Hifz · English, Urdu</p>
</div>
</article>
.teacher { display: flex; gap: 14px; align-items: center; background: #fff;
border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.avatar { flex: 0 0 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
background: var(--green-2); color: var(--gold); font-weight: 700; }
.meta { margin: 0; color: var(--muted); font-size: 14px; }
The initials avatar means the layout never breaks when a photo isn't available — and some teachers may prefer not to publish one.
5. Trial-class panel
The final section answers practical questions: how long is the trial, what's needed, and when can it happen. A definition list fits this content better than a pile of divs.
<section id="trial" class="trial">
<div class="container trial-grid">
<div>
<h2>Book a free trial lesson</h2>
<p>Meet a teacher, check your level and ask questions before committing.</p>
</div>
<dl class="facts">
<div><dt>Length</dt><dd>30 minutes</dd></div>
<div><dt>Format</dt><dd>One-to-one, online</dd></div>
<div><dt>Timing</dt><dd>Flexible across time zones</dd></div>
</dl>
</div>
</section>
.trial { background: var(--green-2); color: #fff; padding: 56px 0; }
.trial-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px 16px;
display: flex; justify-content: space-between; }
.facts dt { color: var(--gold); font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 760px) { .trial-grid { grid-template-columns: 1fr; } }
Testing checklist
- Resize from 320px to 1440px — no horizontal scroll at any width
- Tab through the page — every link and button has a visible focus state
- Run Lighthouse for accessibility and performance
- Check text contrast, especially gold on green
- Test with reduced motion enabled
Wrapping up
Without any framework, a few CSS features do most of the responsive work: custom properties, clamp(), Grid with auto-fit, and a couple of well-placed media queries. For a live example of an online Quran academy organised around similar sections (courses, teachers and a free trial), see Quran Classes 4 U. The same structure adapts easily to any course-based education site.
What patterns do you rely on for education websites? I'd love to hear them in the comments.
Related: Building an Interactive Arabic Alphabet Learning Tool with HTML, CSS and JavaScript
Comments
Join the discussionNo comments yet. Be the first to comment.