Sure! Below is a complete HTML and CSS code for a sleek, modern landing page for a free quiz website. The design is clean and minimalist, emphasizing a fun and interactive nature. The page is also responsive, ensuring it looks great on both desktop and mobile devices.
HTML and CSS Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FunQuiz - Test Your Knowledge</title>
<style>
/* Reset some default styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
}
a {
text-decoration: none;
color: inherit;
}
/* Header */
header {
background-color: #f8f9fa;
padding: 20px;
text-align: center;
}
header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
color: #ff5722;
}
header p {
font-size: 1.1rem;
color: #555;
}
/* Hero Section */
.hero {
background: url('https://source.unsplash.com/1600x900/?quiz,brain') no-repeat center center/cover;
height: 60vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
color: #fff;
}
.hero::after {
content: '';
position: absolute;
top: 0;
left:0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
}
.hero-content {
position: relative;
text-align: center;
}
.hero-content h2 {
font-size: 2rem;
margin-bottom: 20px;
}
.btn {
padding: 12px 25px;
background-color: #ff5722;
color: #fff;
border: none;
border-radius: 25px;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.btn:hover {
background-color: #e64a19;
}
/* Features Section */
.features {
padding: 60px 20px;
background-color: #fff;
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 20px;
}
.feature-card {
flex: 1 1 250px;
background-color: #f1f1f1;
padding: 20px;
border-radius: 10px;
text-align: center;
transition: transform 0.3s ease;
}
.feature-card:hover {
transform: translateY(-10px);
}
.feature-card h3 {
margin-bottom: 15px;
color: #ff5722;
}
.feature-card p {
color: #555;
}
/* Testimonial Section */
.testimonials {
padding: 60px 20px;
background-color: #f8f9fa;
text-align: center;
}
.testimonial {
max-width: 600px;
margin: 0 auto 30px auto;
}
.testimonial p {
font-style: italic;
color: #555;
margin-bottom: 10px;
}
.testimonial span {
display: block;
color: #ff5722;
font-weight: bold;
}
/* Footer */
footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
footer a {
color: #ff5722;
margin: 0 10px;
font-size: 0.9rem;
}
/* Responsive Design */
@media (max-width: 768px) {
.hero {
height: 40vh;
}
.hero-content h2 {
font-size: 1.5rem;
}
.features {
flex-direction: column;
align-items: center;
}
.feature-card {
max-width: 300px;
}
}
</style>
</head>
<body>
<!-- Header -->
<header>
<h1>Welcome to FunQuiz!</h1>
<p>Take our free quizzes and challenge your knowledge today.</p>
</header>
<!-- Hero Section -->
<section class="hero">
<div class="hero-content">
<h2>Ready to Test Yourself?</h2>
<button class="btn">Start the Quiz</button>
</div>
</section>
<!-- Features Section -->
<section class="features">
<div class="feature-card">
<h3>Instant Results</h3>
<p>Get your scores immediately after completing the quiz.</p>
</div>
<div class="feature-card">
<h3>Free to Play</h3>
<p>Enjoy unlimited quizzes without any cost.</p>
</div>
<div class="feature-card">
<h3>Engaging Content</h3>
<p>Dive into a variety of topics and keep learning.</p>
</div>
<div class="feature-card">
<h3>Accessible Anywhere</h3>
<p>Take quizzes on any device, anytime, anywhere.</p>
</div>
</section>
<!-- Testimonial Section -->
<section class="testimonials">
<div class="testimonial">
<p>"FunQuiz has become my go-to for a quick brain boost!"</p>
<span>- Alex P.</span>
</div>
<div class="testimonial">
<p>"I love the variety of quizzes available. Always something new to try."</p>
<span>- Jamie L.</span>
</div>
<div class="testimonial">
<p>"The instant results keep me coming back for more."</p>
<span>- Taylor K.</span>
</div>
</section>
<!-- Footer -->
<footer>
<p>
<a href="#">Privacy Policy</a> |
<a href="#">Terms of Service</a> |
<a href="#">Facebook</a> |
<a href="#">Twitter</a>
</p>
<p>© 2023 FunQuiz. All rights reserved.</p>
</footer>
</body>
</html>
Explanation of the Code
-
HTML Structure:
- Header: Contains the main title and a short description welcoming users to the quiz website.
- Hero Section: Features a full-width background image relevant to quizzes with an overlay for better text visibility. Includes a call-to-action button to encourage users to start the quiz.
- Features Section: Showcases four key selling points using simple cards with headings and descriptions.
- Testimonial Section: Displays user testimonials to build trust and credibility.
- Footer: Includes links to the privacy policy, terms of service, and social media pages, along with a copyright.
-
CSS Styling:
- Reset Styles: Removes default margins and paddings and sets
box-sizing to border-box for easier layout management.
- Typography and Colors: Uses a clean sans-serif font and a color palette centered around a vibrant orange (
#ff5722) to highlight key elements and actions.
- Layout and Spacing: Utilizes Flexbox for layout management, ensuring that sections are well-spaced and responsive.
- Responsive Design: Includes a media query for screens smaller than 768px wide to adjust the hero section height, font sizes, and feature card layouts for better mobile experience.
- Interactive Elements: Adds hover effects to buttons and feature cards to enhance interactivity and user engagement.
-
Images:
- The hero section uses a background image from Unsplash related to quizzes or brains. You can replace the URL with any image that fits your brand.
-
Accessibility:
- Text colors contrast well against backgrounds for readability.
- Buttons and links are easily identifiable and have sufficient padding for clickability.
Customization Tips
- Images: Replace the hero section's background image URL with one that better fits your brand or theme.
- Color Scheme: Adjust the primary color (
#ff5722) to match your branding guidelines.
- Content: Modify the feature points, testimonials, and descriptions to better reflect your quiz's unique selling propositions.
- Fonts: Consider integrating Google Fonts or other web-safe fonts to enhance typography.
Feel free to expand upon this foundation to add more features or improve the design further. This layout provides a solid starting point for a modern and responsive landing page for your free quiz website.