Assignments Of Class 21: Project - Enhancing the Personal Web Page
Assignment 1: Add a Basic Navigation Menu
Task:
Create a navigation menu that links to various sections of the page. Use the <nav>
element and include links for "Home," "About," "Portfolio," and "Contact."
Solution:
1. Create the HTML Structure: First, create a basic HTML structure with sections for each part of your webpage.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personal Web Page
</title>
</head>
<body>
<nav>
<ul>
<li><a href="#home">Home
</a></li>
<li><a href="#about">About
</a></li>
<li><a href="#portfolio">Portfolio
</a></li>
<li><a href="#contact">Contact
</a></li>
</ul>
</nav>
<section id="home">
<h1>Home Section
</h1>
</section>
<section id="about">
<h1>About Section
</h1>
</section>
<section id="portfolio">
<h1>Portfolio Section
</h1>
</section>
<section id="contact">
<h1>Contact Section
</h1>
</section>
</body>
</html>
2. Style the Navigation with CSS: Use CSS to style the navigation and make it user-friendly.
css
nav
ul {
list-style-type: none;
padding:
0;
}
nav
ul
li {
display: inline-block;
margin-right:
20px;
}
nav
ul
li
a {
text-decoration: none;
color:
#333;
font-size:
16px;
}
nav
ul
li
a:hover {
color:
#007BFF;
}
3. Test the Navigation: Open the HTML file in your browser. Click on the links in the navigation menu to ensure it scrolls smoothly to the corresponding sections.
Assignment 2: Add an Image to the Home Section
Task:
In the "Home" section, add an image that represents you. Style it with CSS to have a border-radius and set a specific width.
Solution:
1. Add an Image in HTML:
html
<section id="home">
<h1>Home Section
</h1>
<img src="your-image.jpg" alt="Your Image" width="300" height="200">
</section>
2. Style the Image with CSS: Use CSS to add a border-radius and ensure the image does not overflow.
css
img {
border-radius:
10px;
max-width:
100%;
height: auto;
}
3. Test the Image: Open the webpage and confirm that the image appears in the "Home" section with the correct styling.
Assignment 3: Add Audio to the Page
Task:
In the "About" section, add an audio file that plays background music. Use the <audio>
element with the controls
attribute.
Solution:
1. Add the Audio Element in HTML:
html
<section id="about">
<h1>About Section
</h1>
<audio controls>
<source src="background-music.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
</section>
2. Style the Audio Player: Use CSS to give some margin to the audio element.
css
audio {
margin-top:
20px;
}
3. Test the Audio: Ensure that the audio player appears and functions correctly in the "About" section.
Assignment 4: Add a Contact Form
Task:
Create a contact form in the "Contact" section that includes fields for the user's name, email, and message. Add a submit button.
Solution:
1. Add the Form in HTML:
html
<section id="contact">
<h1>Contact Section
</h1>
<form action="submit_form.php" method="POST">
<label for="name">Name:
</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:
</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:
</label>
<textarea id="message" name="message" required></textarea>
<input type="submit" value="Submit">
</form>
</section>
2. Style the Form with CSS:
css
form {
max-width:
600px;
margin:
0 auto;
padding:
20px;
border:
1px solid
#ccc;
border-radius:
5px;
}
input,
textarea {
width:
100%;
padding:
10px;
margin-bottom:
10px;
border:
1px solid
#ccc;
border-radius:
4px;
}
input[type="submit"] {
background-color:
#007BFF;
color: white;
border: none;
cursor: pointer;
}
input[type="submit"]:hover {
background-color:
#0056b3;
}
3. Test the Form: Check that the form is displayed and functional (you can simulate form submission).
Assignment 5: Create a Responsive Layout
Task:
Make the webpage layout responsive using media queries, so it looks good on both desktop and mobile devices.
Solution:
1. Add Media Queries to CSS: Use media queries to adjust the layout for smaller screens.
css
@media (
max-width:
768px) {
nav
ul {
text-align: center;
}
nav
ul
li {
display: block;
margin-bottom:
10px;
}
form {
width:
90%;
}
}
2. Test Responsiveness: Open the page on a mobile device or resize your browser window to check if the page is responsive.
Assignment 6: Add a Video to the Portfolio Section
Task:
Add a video to the "Portfolio" section that showcases your work or a project. Use the <video>
element with the controls
attribute.
Solution:
1. Add the Video in HTML:
html
<section id="portfolio">
<h1>Portfolio Section
</h1>
<video width="320" height="240" controls>
<source src="project-video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</section>
2. Style the Video: Adjust the styling of the video to make it look more appealing.
css
video {
margin-top:
20px;
max-width:
100%;
}
3. Test the Video: Ensure that the video plays correctly in the "Portfolio" section.
Assignment 7: Add Hover Effects to Navigation Links
Task:
Add hover effects to the navigation links to improve the user experience.
Solution:
1. Modify the Navigation CSS:
css
nav
ul
li
a:hover {
color:
#007BFF;
text-decoration: underline;
}
2. Test the Hover Effect: Open your webpage and hover over the navigation links to check if the hover effect works.
Assignment 8: Add a Footer Section
Task:
Create a footer at the bottom of the page that includes your contact information and social media links.
Solution:
1. Add the Footer in HTML:
html
<footer>
<p>Contact me: your-email@example.com
</p>
<p>Follow me on:
<a href="https://www.facebook.com">Facebook
</a> |
<a href="https://www.twitter.com">Twitter
</a> |
<a href="https://www.linkedin.com">LinkedIn
</a>
</p>
</footer>
2. Style the Footer with CSS:
css
footer {
text-align: center;
padding:
20px;
background-color:
#333;
color: white;
}
footer
a {
color:
#007BFF;
text-decoration: none;
}
footer
a:hover {
text-decoration: underline;
}
3. Test the Footer: Check if the footer appears at the bottom of the page with correct content and links.
Assignment 9: Add Smooth Scrolling
Task:
Enable smooth scrolling when clicking on the navigation links.
Solution:
1. Add Smooth Scrolling to CSS:
css
html {
scroll-behavior: smooth;
}
2. Test Smooth Scrolling: After adding the CSS, test if the page smoothly scrolls to the different sections when clicking on the navigation links.
Assignment 10: Customize Page Background
Task:
Set a custom background color for the page and use an image as the background for the header section.
Solution:
1. Add Background Color to the Body:
css
body {
background-color:
#f4f4f4;
}
2. Add Background Image to the Header Section:
css
section#home {
background-image:
url(
'header-bg.jpg');
background-size: cover;
height:
300px;
text-align: center;
color: white;
}
3. Test the Background: Ensure the page loads with the correct background color and image in the "Home" section.
These assignments should give beginners hands-on experience with different HTML and CSS concepts, helping them build their skills step by step.
You said:
WRITE 50 no of MCQs only FROM ABOVE CONCEPT with explanation
ChatGPT said:
ChatGPT
Here are 50 multiple-choice questions (MCQs) based on the concepts discussed above, with detailed explanations for each answer.