Initial commit: Add sample webpage with HTML, CSS, and JavaScript

This commit is contained in:
2025-11-29 22:15:57 +05:30
commit 3b9d319ed2
5 changed files with 377 additions and 0 deletions

22
.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Dependencies
node_modules/
package-lock.json
yarn.lock
# Build
dist/
build/
# Environment
.env
.env.local

39
README.md Normal file
View File

@@ -0,0 +1,39 @@
# Sample Web Page
A simple, responsive web application built with HTML, CSS, and JavaScript.
## Features
- Responsive design for all devices
- Modern UI with gradient backgrounds
- Smooth navigation and scrolling
- Contact form functionality
- Service cards showcase
## Project Structure
```
.
├── index.html # Main HTML file
├── styles.css # CSS styling
├── script.js # JavaScript functionality
└── README.md # This file
```
## Quick Start
1. Open `index.html` in your browser
2. Navigate through sections using the navigation menu
3. Click "Get Started" button to see the CTA functionality
4. Fill in the contact form to test form submission
## Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
## License
MIT License - Feel free to use this project as a starting point for your own web applications.

78
index.html Normal file
View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample Web Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<nav class="navbar">
<div class="container">
<h1 class="logo">MyWebApp</h1>
<ul class="nav-links">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</nav>
</header>
<main>
<section id="home" class="hero">
<div class="container">
<h2>Welcome to Our Sample Web Page</h2>
<p>This is a sample web application built with HTML, CSS, and JavaScript.</p>
<button class="cta-button" id="ctaBtn">Get Started</button>
</div>
</section>
<section id="about" class="about">
<div class="container">
<h2>About Us</h2>
<p>We create modern, responsive web applications that deliver excellent user experiences.</p>
</div>
</section>
<section id="services" class="services">
<div class="container">
<h2>Services</h2>
<div class="service-grid">
<div class="service-card">
<h3>Web Design</h3>
<p>Beautiful and responsive designs for all devices.</p>
</div>
<div class="service-card">
<h3>Development</h3>
<p>Fast and scalable web applications.</p>
</div>
<div class="service-card">
<h3>Support</h3>
<p>Ongoing maintenance and support services.</p>
</div>
</div>
</div>
</section>
<section id="contact" class="contact">
<div class="container">
<h2>Contact Us</h2>
<form id="contactForm">
<input type="email" placeholder="Your email" required>
<textarea placeholder="Your message" rows="5" required></textarea>
<button type="submit">Send Message</button>
</form>
</div>
</section>
</main>
<footer>
<p>&copy; 2025 MyWebApp. All rights reserved.</p>
</footer>
<script src="script.js"></script>
</body>
</html>

37
script.js Normal file
View File

@@ -0,0 +1,37 @@
// Sample Web Page JavaScript
// CTA Button functionality
document.getElementById('ctaBtn').addEventListener('click', function() {
alert('Welcome! Let\'s get started with your web application.');
console.log('CTA button clicked');
});
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Contact form submission
document.getElementById('contactForm').addEventListener('submit', function(e) {
e.preventDefault();
const email = this.querySelector('input[type="email"]').value;
const message = this.querySelector('textarea').value;
console.log('Form submitted:', { email, message });
alert('Thank you for your message! We will get back to you soon.');
this.reset();
});
// Log page load
document.addEventListener('DOMContentLoaded', function() {
console.log('Page loaded successfully');
});

201
styles.css Normal file
View File

@@ -0,0 +1,201 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header & Navigation */
header {
background-color: #2c3e50;
color: white;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.navbar {
padding: 1rem 0;
}
.navbar .container {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
}
.nav-links {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-links a {
color: white;
text-decoration: none;
transition: color 0.3s ease;
}
.nav-links a:hover {
color: #3498db;
}
/* Hero Section */
.hero {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 100px 0;
text-align: center;
}
.hero h2 {
font-size: 2.5rem;
margin-bottom: 1rem;
}
.hero p {
font-size: 1.2rem;
margin-bottom: 2rem;
}
.cta-button {
background-color: #3498db;
color: white;
padding: 12px 30px;
border: none;
border-radius: 5px;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.cta-button:hover {
background-color: #2980b9;
}
/* Sections */
section {
padding: 60px 0;
border-bottom: 1px solid #eee;
}
section h2 {
font-size: 2rem;
margin-bottom: 2rem;
text-align: center;
}
/* About Section */
.about {
background-color: #f8f9fa;
}
.about p {
font-size: 1.1rem;
text-align: center;
max-width: 800px;
margin: 0 auto;
}
/* Services Section */
.service-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
margin-top: 2rem;
}
.service-card {
background: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.service-card:hover {
transform: translateY(-5px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.service-card h3 {
margin-bottom: 1rem;
color: #667eea;
}
/* Contact Section */
.contact {
background-color: #f8f9fa;
}
#contactForm {
max-width: 600px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 1rem;
}
#contactForm input,
#contactForm textarea {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
font-family: inherit;
}
#contactForm button {
background-color: #667eea;
color: white;
padding: 12px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#contactForm button:hover {
background-color: #764ba2;
}
/* Footer */
footer {
background-color: #2c3e50;
color: white;
text-align: center;
padding: 2rem 0;
margin-top: 3rem;
}
/* Responsive */
@media (max-width: 768px) {
.nav-links {
gap: 1rem;
font-size: 0.9rem;
}
.hero h2 {
font-size: 1.8rem;
}
section h2 {
font-size: 1.5rem;
}
}