Web Design Record Final
Web Design Record Final
COIMBATORE-641105
NAME :
CLASS : II MCA
SEMESTER : III
SUBJECTCODE : MC4023
BONAFIDE CERTIFICATE
by ________________________________________________________
Coimbatore.
AIM:
To Design and Develop an event registration form.
SOURCE CODE:
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Registration</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="form-container">
<h2>Register for the Event</h2>
<form id="regForm" onsubmit="return validateForm()">
<input type="text" id="name" placeholder="Full Name" required>
<input type="email" id="email" placeholder="Email" required>
<input type="tel" id="phone" placeholder="Phone" required pattern="^\+?[1-9]\d{1,14}$">
<input type="date" id="event_date" required>
<select id="attending" required>
<option value="yes">--Select Item--</option>
<option value="yes">Classical Dance</option>
<option value="no">Break Dance</option>
<option value="no">Singing</option>
<option value="no">Drawing</option>
</select>
<textarea id="comments" placeholder="Additional Comments (Optional)"></textarea>
<button type="submit">Register</button>
</form>
<div id="responseMessage"></div>
</div>
<script src="script.js"></script>
</body>
</html>
styles.css:
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
h2 {
margin: 0;
font-size: 24px;
color: #333;
text-align: center;
}
.form-container {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
}
input,select,textarea,
button {
width: 100%;
padding: 10px;
margin: 8px 0;
border-radius: 4px;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background: #28a745;
color: white;
cursor: pointer;
border: none;
}
button:hover {
background: #218838;
}
#responseMessage {
margin-top: 15px;
text-align: center;
color: #28a745;
}
OUTPUT:
RESULT:
The event registration form is developed successfully and the output is verified.
3
EX NO.2 DESIGN AND DEVELOP A STICKY NAVBAR USING FLOATS AND SASS.
AIM:
To Design And Develop A Sticky Navbar Using Floats And SASS.
SOURCE CODE:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Sticky Navbar</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<header>
<nav>
<ul>
<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>
</nav>
</header>
<main>
<section id="home">
<h1>Home</h1>
</section>
<section id="about">
<h1>About</h1>
</section>
<section id="services">
<h1>Services</h1>
</section>
<section id="contact">
<h1>Contact</h1>
4
</section>
</main>
</body>
</html>
styles.css:
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
} header {
position: fixed;
top: 0;
width: 100%;
background-color: #333;
z-index: 1000;
nav ul {
list-style: none;
padding: 0;
margin: 0;
li {
float: left;
padding: 15px 20px;
a{
color: white;
text-decoration: none;
&:hover {
background-color: #575757; }
}}}}
main {
margin-top: 60px;
padding: 20px;
section {
padding: 40px 0;
h1 {
margin-bottom: 10px;} } }
OUTPUT:
RESULT:
Thus, Sticky Navbar Using Floats And SASS has been created successfully and output is verified.
EX NO.3 DESIGN AND DEVELOP A DEVELOPER PORTFOLIO PAGE. DEVELOP THE LAYOUT
USING FLEXBOX AND ENSURE THE PAGE IS RESPONSIVE.
AIM:
To Design and develop a developer portfolio page. Develop the layout using flexbox and ensure the page is
responsive.
SOURCE CODE:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Developer Portfolio</title>
<link rel="stylesheet" href="styles.css"> </head>
<body>
<header>
<h1>Akhil P A</h1>
<nav>
<a href="#about">About</a>
<a href="#skills">Skills</a>
<a href="#projects">Projects</a>
<a href="#contact">Contact</a>
</nav> </header>
<section id="about">
<h2>About Me</h2>
<div class="flex">
<div class="card">I'm a web developer with a passion for front-end technologies.</div>
<div class="card">I specialize in creating clean, responsive websites with modern tools.</div>
</div> </section>
<section id="skills">
<h2>Skills</h2>
<div class="flex">
<div class="card">
<h3>Languages</h3>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul> </div>
<div class="card">
<h3>Frameworks</h3>
<ul>
<li>React</li>
<li>Node.js</li>
</ul>
</div> </div> </section>
<section id="projects">
<h2>Projects</h2>
<div class="flex">
<div class="card">
<h3>Portfolio</h3>
<p>Showcasing my work as a developer.</p>
</div>
<div class="card">
<h3>Task Manager</h3>
<p>A simple task management app to track daily tasks.</p>
</div> </div> </section>
<section id="contact">
<h2>Contact</h2>
<form>
<input type="text" placeholder="Your Name" required>
<input type="email" placeholder="Your Email" required>
<textarea placeholder="Your Message" required></textarea>
<button type="submit">Send Message</button>
</form> </section>
</body> </html>
styles.css:
/* Basic reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: #f9f9f9; }
header {
background: #333;
color: white;
padding: 20px;
text-align: center; }
nav a {
color: white;
text-decoration: none;
margin: 0 15px; }
section {
padding: 40px 20px;
max-width: 1000px;
margin: auto; }
.flex {
display: flex;
flex-wrap: wrap;
gap: 20px; }
.card {
background: white;
padding: 20px;
border-radius: 5px;
flex: 1 1 30%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
h1, h2 {
margin-bottom: 10px; }
ul {
list-style: none;
padding-left: 0; }
input, textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc; }
button {
background: #333;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer; }
button:hover {
background: #555; }
/* Responsive design */
@media (max-width: 768px) {
.card {
flex: 1 1 100%; }}
OUTPUT:
RESULT:
Thus, a responsive developer portfolio page has been developed successfully using flexbox and the output has been
verified.
10
EX NO.4 DESIGN AND DEVELOP PRICING CARD LIST WHICH ARE RESPONSIVE USING
PLAIN CSS AND FLEXBOX
AIM:
To Design and develop pricing card list which are responsive using plain CSS and Flexbox.
SOURCE CODE:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pricing Cards</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<section class="pricing-container">
<div class="pricing-card popular">
<h2>Standard Plan</h2>
<p class="price">$49/month</p>
<ul>
<li>50 GB Storage</li>
<li>Priority Support</li>
<li>Free Updates</li>
</ul>
<button>Select Plan</button>
</div>
<div class="pricing-card">
<h2>Basic Plan</h2>
<p class="price">$19/month</p>
<ul>
<li>10 GB Storage</li>
<li>Basic Support</li>
<li>Free Updates</li>
</ul>
<button>Select Plan</button>
</div>
11
<div class="pricing-card">
<h2>Premium Plan</h2>
<p class="price">$99/month</p>
<ul>
<li>200 GB Storage</li>
<li>24/7 Support</li>
<li>Free Updates</li>
</ul>
<button>Select Plan</button>
</div>
</section>
</body>
</html>
index.css:
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
padding: 40px;
display: flex;
justify-content: center;
background: #f4f4f4;
}
.pricing-container {
display: flex;
gap: 20px;
flex-wrap: wrap;
max-width: 1200px;
width: 100%;
justify-content: center;
}
.pricing-card {
background: #fff;
padding: 20px;
width: 280px;
border-radius: 10px;
text-align: center;
12
ul li {
margin: 8px 0;
}
button {
background: #ff6600;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background: #e65c00; }
13
OUTPUT:
RESULT:
Thus a responsive pricing card list has been developed successfully using CSS and flexbox and output is verified.
14
EX NO.5 DEVELOP A REGISTER FORM AND VALIDATE IT USING JAVASCRIPT. DESIGN THE
FORMS USING CSS3 AND DISPLAY ERROR MESSAGES IN THE HTML PAGE.
AIM:
To Develop a register form and validate it using JavaScript. Design the forms using CSS3 and display Error Messages
in the HTML page.
SOURCE CODE:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="form-container">
<h2>Register</h2>
<form id="registerForm" onsubmit="return validateForm()">
<div class="input-group">
<label for="username">Username</label>
<input type="text" id="username" placeholder="Enter your username">
<span class="error" id="usernameError"></span>
</div>
<div class="input-group">
<label for="email">Email</label>
<input type="email" id="email" placeholder="Enter your email">
<span class="error" id="emailError"></span>
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Enter your password">
<span class="error" id="passwordError"></span>
</div>
<button type="submit">Register</button> </form> </div>
<script src="script.js"></script>
15
</body>
</html>
styles.css:
*{
margin: 0;
padding: 0;
box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh; }
.form-container {
background-color: #fff;
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px; }
h2 {
text-align: center;
margin-bottom: 20px;
font-size: 24px;
color: #333; }
.input-group {
margin-bottom: 15px; }
label {
display: block;
font-size: 14px;
color: #555;
margin-bottom: 5px; }
input {
width: 100%;
padding: 10px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 4px;
margin-top: 5px; }
16
input:focus {
border-color: #007BFF;
outline: none; }
button {
width: 100%;
padding: 12px;
font-size: 16px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 10px; }
button:hover {
background-color: #218838; }
.error {
color: #dc3545;
font-size: 12px;
margin-top: 5px; }
script.js:
function validateForm() {
let isValid = true;
const username = document.getElementById('username').value;
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
const usernameError = document.getElementById('usernameError');
const emailError = document.getElementById('emailError');
const passwordError = document.getElementById('passwordError');
usernameError.textContent = emailError.textContent = passwordError.textContent = '';
if (!username) {
usernameError.textContent = 'Username is required';
isValid = false;
}
if (!email || !/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(email)) {
emailError.textContent = 'Invalid email';
isValid = false;
}
if (!password || password.length < 6) {
passwordError.textContent = 'Password must be at least 6 characters';
isValid = false;
17
}
return isValid;
}
OUTPUT:
RESULT:
Thus a register form has been developed and validated successfully using javascript and output is verified.
18
EX NO.6 DEVELOP A WEBSITE THAT USES THE ‘JSONPLACEHOLDER’ API TO GET POSTS
DATA AND DISPLAY THEM IN THE FORM OF A CARD.
USE FLEXBOX TO STYLE THE CARDS
AIM:
To Develop a website that uses the ‘jsonplaceholder’ Api to get posts data and display them in the form of a card. Use
Flexbox to style the cards.
SOURCE CODE:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Posts Display</title>
<link rel="stylesheet" href="styles.css"> </head>
<body>
<div class="container">
<h1>Posts</h1>
<div id="posts" class="posts-container">
<!-- Posts will be dynamically added here -->
</div> </div>
<script src="script.js"></script> </body> </html>
styles.css:
*{
margin: 0;
padding: 0;
box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0; }
.container {
19
width: 90%;
max-width: 1200px;
text-align: center; }
.card {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
width: 300px;
min-height: 250px;
display: flex;
flex-direction: column;
justify-content: space-between; }
.card h2 {
font-size: 20px;
margin-bottom: 10px; }
.card p {
font-size: 14px;
color: #333; }
.card button {
align-self: flex-start;
padding: 8px 16px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer; }
.card button:hover {
background-color: #0056b3; }
script.js:
async function fetchPosts() {
const response = await fetch('https://jsonplaceholder.typicode.com/posts');
const posts = await response.json();
const postsContainer = document.getElementById('posts');
posts.slice(0, 6).forEach(post => {
const card = document.createElement('div');
card.classList.add('card');
card.innerHTML = `
<h2>${post.title}</h2>
20
<p>${post.body}</p>
<button onclick="alert('Post ID: ${post.id}')">Read More</button>
`; postsContainer.appendChild(card);
}); }
window.onload = fetchPosts;
OUTPUT:
RESULT:
Thus a website that uses jsonplaceholder API has been developed successfully and output is verified.
21
EX NO.7 DEVELOP A PHP SERVER THAT CREATES, READS, UPDATES AND DELETES
TODO AND SAVE THEM IN MYSQL DATABASE.
AIM:
To Develop a php server that Creates, Reads, Updates and Deletes Todo and save them in MySQL database.
SOURCE CODE:
config.php:
<?php
$host = 'localhost';
$dbname = 'todo_app';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname",'root','');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
create.php:
<?php
include 'config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$title = $_POST['title'];
$description = $_POST['description'];
if ($title) {
$stmt = $pdo->prepare("INSERT INTO todos (title, description) VALUES (?, ?)");
$stmt->execute([$title, $description]);
echo "To-Do Created Successfully!";
} else {
echo "Title is required!"; } }
?>
<!-- Simple form for creating a To-Do -->
<form action="create.php" method="POST">
<input type="text" name="title" placeholder="Title" required>
<textarea name="description" placeholder="Description"></textarea>
<button type="submit">Create To-Do</button> </form>
read.php:
<?php
include 'config.php';
22
23
$id = $_GET['id'];
$stmt = $pdo->prepare("DELETE FROM todos WHERE id = ?");
$stmt->execute([$id]);
echo "To-Do Deleted Successfully!";
}
?>
OUTPUT:
24
RESULT:
Thus a Todo list is created successfully using PHP to perform CRUD operations and the output is verified.
25
EX NO.8 DEVELOP A PHP SERVER THAT REGISTERS AND AUTHENTICATES USER SESSION
AND STORES USER DATA IN MYSQL DATABASE.
AIM:
Develop a php server that registers and authenticates user session and stores user data in MySQL database.
SOURCE CODE:
register.php:
<?php
session_start();
include('db.php');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$email = $_POST['email'];
if ($username && $password && $email) {
$stmt = $pdo->prepare("SELECT id FROM users WHERE username = :username");
$stmt->execute(['username' => $username]);
if ($stmt->fetch()) {
echo "Username already taken."; } else {
$stmt = $pdo->prepare("INSERT INTO users (username, password, email) VALUES (?, ?, ?)");
$stmt->execute([$username, $password, $email]);
echo "Registration successful!"; }
} else {
echo "All fields are required."; } }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Register</title></head>
<body>
<form method="POST">
Username: <input type="text" name="username" required><br>
Email: <input type="email" name="email" required><br>
Password: <input type="password" name="password" required><br>
<button type="submit">Register</button> </form> </body> </html>
login.php:
<?php
26
session_start();
include('db.php');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
if ($username && $password) {
$stmt = $pdo->prepare("SELECT id, password FROM users WHERE username = :username");
$stmt->execute(['username' => $username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
echo "Logged in successfully!";
} else {
echo "Invalid credentials.";
} } else {
echo "Please enter both username and password.";
}}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<form method="POST">
Username: <input type="text" name="username" required><br>
Password: <input type="password" name="password" required><br>
<button type="submit">Login</button> </form> </body> </html>
profile.php:
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit; }
echo "Welcome, user with ID: " . $_SESSION['user_id'] . "!<br>";
echo "<a href='logout.php'>Logout</a>";
?>
db.php:
<?php
27
OUTPUT:
28
RESULT:
Thus a PHP server that registers and authenticates user session and stores user data in MySQL has been developed
successfully and output is verified.
29