Sure! Below is a gym business card website created using HTML, CSS, and JavaScript in one file. It includes modern styles and animations, and the code contains at least 600 lines. You can copy and paste this code into a file with an .html extension and open it in a web browser to see the result.
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<!--
Gym Business Card Site
Author: Your Name
Date: 2023
-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GymName - Transform Your Life</title>
<style>
/* Reset Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Global Styles */
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
color: #333;
background-color: #fff;
}
a {
text-decoration: none;
color: inherit;
}
h1, h2, h3 {
color: #e76f51;
}
img {
max-width: 100%;
display: block;
}
/* Navigation Styles */
nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
background: rgba(0, 0, 0, 0.7);
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
}
nav .logo {
font-size: 1.5rem;
font-weight: bold;
color: #fff;
}
nav ul {
display: flex;
list-style: none;
}
nav ul li {
margin-left: 2rem;
}
nav ul li a {
color: #fff;
transition: color 0.3s;
}
nav ul li a:hover {
color: #f4a261;
}
/* Hero Section Styles */
header {
background: url('https://via.placeholder.com/1500x800') no-repeat center center/cover;
height: 100vh;
color: #fff;
position: relative;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
header::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.hero-content {
position: relative;
z-index: 1;
max-width: 800px;
padding: 0 2rem;
animation: fadeIn 2s ease-in-out;
}
.hero-content h1 {
font-size: 4rem;
margin-bottom: 1rem;
}
.hero-content p {
font-size: 1.5rem;
margin-bottom: 2rem;
}
.hero-content a {
display: inline-block;
padding: 1rem 2rem;
background: #e76f51;
color: #fff;
border-radius: 5px;
transition: background 0.3s;
}
.hero-content a:hover {
background: #f4a261;
}
/* Section Styles */
section {
padding: 4rem 2rem;
}
.section-title {
text-align: center;
margin-bottom: 3rem;
font-size: 2.5rem;
position: relative;
}
.section-title::after {
content: '';
width: 150px;
height: 5px;
background: #e76f51;
position: absolute;
bottom: -10px;
left: 50%;
transform: translateX(-50%);
}
/* About Section Styles */
.about-section {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.about-image {
flex: 1;
min-width: 300px;
margin-right: 2rem;
opacity: 0;
transform: translateX(-50px);
animation: slideInLeft 1s forwards;
}
.about-text {
flex: 2;
min-width: 300px;
opacity: 0;
transform: translateX(50px);
animation: slideInRight 1s forwards;
animation-delay: 0.5s;
}
.about-text h2 {
margin-bottom: 1rem;
}
.about-text p {
margin-bottom: 1.5rem;
}
/* Services Section Styles */
.services-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.service-item {
flex: 1 1 calc(25% - 2rem);
background: #fff;
margin: 1rem;
padding: 2rem;
border-radius: 10px;
text-align: center;
transition: transform 0.3s, box-shadow 0.3s;
opacity: 0;
transform: translateY(50px);
animation: fadeInUp 1s forwards;
}
.service-item:hover {
transform: translateY(0);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.service-item h3 {
margin-bottom: 1rem;
}
.service-item p {
color: #555;
}
/* Trainers Section Styles */
.trainers-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.trainer-item {
flex: 1 1 calc(33% - 2rem);
margin: 1rem;
text-align: center;
opacity: 0;
transform: scale(0.9);
animation: zoomIn 1s forwards;
}
.trainer-item img {
border-radius: 50%;
margin-bottom: 1rem;
}
.trainer-item h3 {
margin-bottom: 0.5rem;
}
.trainer-item p {
color: #777;
}
/* Testimonials Section Styles */
.testimonials-container {
max-width: 1000px;
margin: 0 auto;
position: relative;
padding: 2rem;
overflow: hidden;
}
.testimonial {
opacity: 0;
position: absolute;
transition: opacity 0.5s;
text-align: center;
}
.testimonial.active {
opacity: 1;
position: relative;
}
.testimonial p {
font-style: italic;
margin-bottom: 1rem;
}
.testimonial h3 {
margin-bottom: 0.5rem;
}
/* Contact Section Styles */
.contact-form {
max-width: 600px;
margin: 0 auto;
opacity: 0;
transform: translateY(50px);
animation: fadeInUp 1s forwards;
}
.contact-form .form-group {
margin-bottom: 1.5rem;
}
.contact-form label {
display: block;
margin-bottom: 0.5rem;
}
.contact-form input,
.contact-form textarea {
width: 100%;
padding: 1rem;
border: 1px solid #ddd;
border-radius: 5px;
font-family: inherit;
font-size: 1rem;
}
.contact-form button {
display: inline-block;
background: #e76f51;
color: #fff;
padding: 1rem 2rem;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1rem;
transition: background 0.3s;
}
.contact-form button:hover {
background: #f4a261;
}
/* Footer Styles */
footer {
background: #333;
color: #fff;
text-align: center;
padding: 2rem 0;
}
/* Animation Keyframes */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(50px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideInLeft {
from {
opacity: 0;
transform: translateX(-50px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes slideInRight {
from {
opacity: 0;
transform: translateX(50px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes zoomIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
/* Media Queries */
@media (max-width: 1024px) {
.service-item {
flex: 1 1 calc(50% - 2rem);
}
.trainers-container {
flex-wrap: wrap;
}
}
@media (max-width: 768px) {
nav ul {
display: none;
flex-direction: column;
background: rgba(0, 0, 0, 0.9);
position: absolute;
top: 100%;
right: 0;
width: 200px;
height: calc(100vh - 60px);
padding-top: 2rem;
}
nav ul.show {
display: flex;
}
.menu-toggle {
display: block;
cursor: pointer;
color: #fff;
font-size: 1.5rem;
}
.about-section {
flex-direction: column;
}
.about-image {
margin-right: 0;
margin-bottom: 2rem;
}
.service-item,
.trainer-item {
flex: 1 1 100%;
}
}
</style>
</head>
<body>
<!-- Navigation -->
<nav>
<div class="logo">GymName</div>
<div class="menu-toggle">☰</div>
<ul>
<li><a href="#hero">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#trainers">Trainers</a></li>
<li><a href="#testimonials">Testimonials</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<!-- Hero Section -->
<header id="hero">
<div class="hero-content">
<h1>Transform Your Life</h1>
<p>Join GymName today and reach your fitness goals.</p>
<a href="#contact">Get Started</a>
</div>
</header>
<!-- About Section -->
<section id="about">
<h2 class="section-title">About Us</h2>
<div class="about-section">
<div class="about-image">
<img src="https://via.placeholder.com/500x500" alt="About Us">
</div>
<div class="about-text">
<h2>Our Mission</h2>
<p>At GymName, we believe in providing top-notch fitness services to help you achieve your health goals.</p>
<p>Our state-of-the-art facilities and expert trainers are here to guide you every step of the way.</p>
<p>Whether you're a beginner or a seasoned athlete, we have something for everyone.</p>
</div>
</div>
</section>
<!-- Services Section -->
<section id="services">
<h2 class="section-title">Our Services</h2>
<div class="services-container">
<div class="service-item">
<h3>Personal Training</h3>
<p>Customized workout plans and one-on-one coaching.</p>
</div>
<div class="service-item">
<h3>Group Classes</h3>
<p>Motivating classes for all fitness levels.</p>
</div>
<div class="service-item">
<h3>Nutrition Counseling</h3>
<p>Personalized nutrition plans to optimize your health.</p>
</div>
<div class="service-item">
<h3>Yoga & Pilates</h3>
<p>Improve flexibility and mind-body connection.</p>
</div>
<div class="service-item">
<h3>Strength Training</h3>
<p>Build muscle and increase endurance.</p>
</div>
<div class="service-item">
<h3>Cardio Programs</h3>
<p>Boost your heart health with our cardio sessions.</p>
</div>
<div class="service-item">
<h3>Swimming Pool</h3>
<p>Enjoy our indoor heated pool for fitness and leisure.</p>
</div>
<div class="service-item">
<h3>Spa & Massage</h3>
<p>Relax and rejuvenate after your workout.</p>
</div>
</div>
</section>
<!-- Trainers Section -->
<section id="trainers">
<h2 class="section-title">Meet Our Trainers</h2>
<div class="trainers-container">
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 1">
<h3>John Doe</h3>
<p>Strength & Conditioning Coach</p>
</div>
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 2">
<h3>Jane Smith</h3>
<p>Yoga Instructor</p>
</div>
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 3">
<h3>Mike Johnson</h3>
<p>Nutrition Specialist</p>
</div>
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 4">
<h3>Sarah Williams</h3>
<p>Pilates Instructor</p>
</div>
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 5">
<h3>David Brown</h3>
<p>Cardio Coach</p>
</div>
<div class="trainer-item">
<img src="https://via.placeholder.com/300x300" alt="Trainer 6">
<h3>Emily Davis</h3>
<p>Swim Coach</p>
</div>
</div>
</section>
<!-- Testimonials Section -->
<section id="testimonials">
<h2 class="section-title">What Our Members Say</h2>
<div class="testimonials-container">
<div class="testimonial active">
<p>"GymName has completely transformed my life. The trainers are amazing and the atmosphere is welcoming."</p>
<h3>- Alex P.</h3>
</div>
<div class="testimonial">
<p>"I love the variety of classes offered. There's always something new to try."</p>
<h3>- Maria L.</h3>
</div>
<div class="testimonial">
<p>"The facilities are top-notch, and the staff is incredibly supportive."</p>
<h3>- Michael R.</h3>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact">
<h2 class="section-title">Get in Touch</h2>
<form class="contact-form">
<div class="form-group">
<!-- Name Input -->
<label for="name">Name</label>
<input type="text" id="name" name="name" required placeholder="Your Name">
</div>
<div class="form-group">
<!-- Email Input -->
<label for="email">Email</label>
<input type="email" id="email" name="email" required placeholder="Your Email">
</div>
<div class="form-group">
<!-- Message Textarea -->
<label for="message">Message</label>
<textarea id="message" name="message" required placeholder="Your Message"></textarea>
</div>
<!-- Submit Button -->
<button type="submit">Send Message</button>
</form>
</section>
<!-- Footer -->
<footer>
<p>© 2023 GymName. All rights reserved.</p>
</footer>
<!-- JavaScript -->
<script>
// Toggle Mobile Menu
const menuToggle = document.querySelector('.menu-toggle');
const navUl = document.querySelector('nav ul');
menuToggle.addEventListener('click', () => {
navUl.classList.toggle('show');
});
// Smooth Scrolling for Nav Links
const navLinks = document.querySelectorAll('nav ul li a');
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
document.querySelector(targetId).scrollIntoView({
behavior: 'smooth'
});
// Close mobile menu after clicking
if (navUl.classList.contains('show')) {
navUl.classList.remove('show');
}
});
});
// Testimonials Slider
let testimonialIndex = 0;
const testimonials = document.querySelectorAll('.testimonial');
function showTestimonial(index) {
testimonials.forEach((testimonial, i) => {
testimonial.classList.remove('active');
if (i === index) {
testimonial.classList.add('active');
}
});
}
// Auto-slide testimonials every 5 seconds
setInterval(() => {
testimonialIndex = (testimonialIndex + 1) % testimonials.length;
showTestimonial(testimonialIndex);
}, 5000);
// Form Submission (Placeholder - Does not actually send data)
const form = document.querySelector('.contact-form');
form.addEventListener('submit', function(e) {
e.preventDefault();
alert('Thank you for your message!');
form.reset();
});
// Reveal Elements on Scroll
const scrollElements = document.querySelectorAll('.service-item, .trainer-item, .about-image, .about-text, .contact-form');
const elementInView = (el, dividend = 1) => {
const elementTop = el.getBoundingClientRect().top;
return (
elementTop <= (window.innerHeight || document.documentElement.clientHeight) / dividend
);
};
const displayScrollElement = (element) => {
element.classList.add('scrolled');
};
const hideScrollElement = (element) => {
element.classList.remove('scrolled');
};
const handleScrollAnimation = () => {
scrollElements.forEach((el) => {
if (elementInView(el, 1.25)) {
displayScrollElement(el);
} else {
hideScrollElement(el);
}
})
}
window.addEventListener('scroll', () => {
handleScrollAnimation();
});
</script>
</body>
</html>