0% found this document useful (0 votes)
7 views4 pages

HTML & CSS Assignment for Class VIII

Uploaded by

swastikpromax
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

HTML & CSS Assignment for Class VIII

Uploaded by

swastikpromax
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT ON HTML & CSS

Class – VIII
Subject – Computer

Acknowledgement
I would like to express my sincere gratitude to my Computer teacher [Teacher’s Name] for guiding
me in completing this assignment on HTML & CSS. I am also thankful to my parents and friends for
their support and encouragement.

- [Your Name]

Q1. Create a webpage with heading 'My First Styled Page' and
background color lightblue.
<!DOCTYPE html>
<html>
<head>
<title>My First Styled Page</title>
<style>
body { background-color: lightblue; text-align: center; font-family: Arial; }
h1 { color: darkblue; }
</style>
</head>
<body>
<h1>My First Styled Page</h1>
</body>
</html>

Q2. Display an image ([Link]) in the center of the page with a


2px solid red border.
<!DOCTYPE html>
<html>
<head>
<title>Image Example</title>
<style>
img { display: block; margin: auto; border: 2px solid red; }
</style>
</head>
<body>
<img src="[Link]" alt="Flower">
</body>
</html>

Q3. Create a link to [Link] with the text 'Visit


Wikipedia'. Style link green without underline.
<!DOCTYPE html>
<html>
<head>
<title>Wikipedia Link</title>
<style>
a { color: green; text-decoration: none; }
</style>
</head>
<body>
<a href="[Link] target="_blank">Visit Wikipedia</a>
</body>
</html>

Q4. Create a profile card with your name, photo, and short
description.
<!DOCTYPE html>
<html>
<head>
<title>Profile Card</title>
<style>
.card {
width: 300px; margin: auto; padding: 20px;
background-color: #f2f2f2; text-align: center;
border-radius: 10px; box-shadow: 2px 2px 8px gray;
}
img { width: 100px; border-radius: 50%; }
</style>
</head>
<body>
<div class="card">
<img src="[Link]" alt="Profile Photo">
<h2>Your Name</h2>
<p>A short description about yourself.</p>
</div>
</body>
</html>

Q5. Create a list of your 5 favorite movies with different


background colors.
<!DOCTYPE html>
<html>
<head>
<title>Favorite Movies</title>
<style>
li:nth-child(1) { background-color: lightcoral; }
li:nth-child(2) { background-color: lightgreen; }
li:nth-child(3) { background-color: lightblue; }
li:nth-child(4) { background-color: lightyellow; }
li:nth-child(5) { background-color: lightpink; }
</style>
</head>
<body>
<h2>My Favorite Movies</h2>
<ul>
<li>Movie 1</li>
<li>Movie 2</li>
<li>Movie 3</li>
<li>Movie 4</li>
<li>Movie 5</li>
</ul>
</body>
</html>

Q6. Create a simple registration form with Name, Email, Password


and Submit button.
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<form>
Name: <input type="text" name="name"><br><br>
Email: <input type="email" name="email"><br><br>
Password: <input type="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>

Q7. Create a frameset with two frames: Left (links), Right (pages).
<!DOCTYPE html>
<html>
<head>
<title>Frameset Example</title>
</head>
<frameset cols="30%,70%">
<frame src="[Link]">
<frame src="[Link]" name="rightFrame">
</frameset>
</html>

Q8. Create a navigation bar with 4 links (Home, Gallery, About,


Contact).
<!DOCTYPE html>
<html>
<head>
<title>Navigation Bar</title>
<style>
ul { list-style: none; background-color: #333; padding: 0; margin: 0; overflow: hidden; }
li { float: left; }
li a {
display: block; color: white; text-align: center;
padding: 14px 20px; text-decoration: none;
}
li a:hover { background-color: #111; }
</style>
</head>
<body>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</body>
</html>

Q9. Create a gallery of 4 images in a grid style with borders and


spacing.
<!DOCTYPE html>
<html>
<head>
<title>Image Gallery</title>
<style>
.gallery {
display: grid; grid-template-columns: auto auto;
gap: 10px; margin: 20px;
}
img { width: 100%; border: 2px solid black; }
</style>
</head>
<body>
<div class="gallery">
<img src="[Link]">
<img src="[Link]">
<img src="[Link]">
<img src="[Link]">
</div>
</body>
</html>

Q10. Create a mini webpage with school info, subjects list, and
form.
<!DOCTYPE html>
<html>
<head>
<title>My School Website</title>
</head>
<body>
<h1>My School Website</h1>
<img src="[Link]" alt="My School" width="300"><br><br>
<p>This is my school. It is one of the best schools in the city.</p>
<h3>Subjects</h3>
<ul>
<li>English</li>
<li>Mathematics</li>
<li>Science</li>
<li>Social Studies</li>
<li>Computer</li>
</ul>
<h3>Student Form</h3>
<form>
Name: <input type="text" name="name"><br><br>
Class: <input type="text" name="class"><br><br>
<input type="submit" value="Submit">
</form>
<br>
<a href="[Link] School Website</a>
</body>
</html>

Conclusion
Through this assignment, I learned how to create webpages using HTML and style them with CSS.
I understood how to add headings, images, links, forms, navigation bars, and galleries to a
webpage. This project helped me improve my creativity and technical skills in web designing.

- [Your Name]

Common questions

Powered by AI

Using `frameset` in HTML allows for dividing the browser window into several sections, each capable of displaying different documents, which can be advantageous for implementing a fixed navigation structure as shown in the two-frame example. However, `frameset` is deprecated in HTML5, and its use limits accessibility features, interferes with SEO as each frame has its URL, and makes responsive design implementation difficult. These disadvantages highlight why modern web design prefers div-based layouts with CSS Flexbox or Grid for achieving the same goals more effectively .

The HTML and CSS example of a profile card shows responsive design principles through its use of percentage-based widths and `auto` margins. The `card` class is set to a fixed width in pixels, which is not inherently responsive, but the margin set to `auto` centers the card horizontally, which helps in maintaining its position on different devices. Additionally, the photo uses a percentage width, ensuring it scales relative to its container, which is a typical approach in responsive design to accommodate screen size variations .

Background colors are pivotal in web design to delineate sections, enhance visual hierarchy, and guide user navigation through contrast and emphasis. By strategically applying different backgrounds, designers direct attention to focal content areas, improve readability, and create intuitive navigation paths. Colors can evoke emotions and brand identity, reinforcing the overall user experience while contributing to an aesthetically unified and engaging webpage .

The incorporation of CSS box shadows adds depth and dimensionality, creating a more realistic and engaging interface by providing visual cues about the spatial relationships of elements. Shadows enhance the perception of elements being layered above the page, helping users differentiate between active and static components. It contributes to a perception of interactivity and focuses user attention on key features. Effective use of shadows can enhance aesthetic appeal while maintaining a modern, polished look without overwhelming the design .

Semantic HTML elements inherently define the purpose and role of content on a webpage, thus improving both its accessibility and search engine optimization. For accessibility, elements like `<header>`, `<nav>`, and `<footer>` provide screen reader users with meaningful structure, facilitating easier navigation and comprehension. For SEO, search engines prioritize semantic and well-structured HTML, which aids in more accurately indexing and understanding the content, leading to better search result rankings. This approach also aids developer maintenance and collaboration by conveying clear intent within the code structure .

Styling links without underlines and using colored text can enhance the user interface by creating a cleaner and more visually appealing design. It helps in highlighting links while maintaining consistency with the overall color scheme, avoiding visual clutter. However, care must be taken to ensure accessibility; links should be distinguishable through other means such as contrast or hover effects, ensuring users can identify interactive elements easily without relying solely on color distinctions .

Integrating a simple registration form can enhance user engagement by converting visitors into registered users, facilitating personalization and targeted interactions. Best practices for form design include keeping the form minimal with essential fields only, using clear and descriptive labels, ensuring feedback on input errors, maintaining logical tab order, and protecting user data with secure connections. Designing with accessibility in mind, such as providing sufficient contrast and supporting keyboard navigation, also ensures broader user inclusivity .

CSS is crucial for refining the aesthetic components of a webpage by providing a range of properties such as color, spacing, borders, and layout control. Different selectors can target individual HTML elements, classes, or IDs to apply specific styles. For example, a class selector (.) can be used to apply styles to multiple elements by assigning the same class name, an ID selector (#) targets specific elements assigned a unique ID, and element selectors target all elements of the same type. Each selector allows developers to customize the presentation of individual parts of a webpage effectively .

Implementing a grid-style gallery using CSS Grid enhances user experience by allowing a flexible and aesthetically pleasing layout where images are automatically responsive. CSS Grid enables defining columns and rows, allowing for consistent image and spacing uniformity. This approach maximizes viewing engagement and allows users to appreciate all images proportionally regardless of screen size adaptations. Moreover, it improves load performance and scalability, as additional images can be integrated seamlessly using the `grid-template` properties without restructuring the HTML layout .

Pseudo-classes like `:nth-child` enable styling based on element position, providing versatility for lists with dynamic content. They allow designers to apply styles systematically, such as alternating row colors, without requiring additional classes, simplifying DOM structure. This dynamic and responsive approach ensures ease of maintenance and adaptation as content changes. The use of `nth-child` also enhances performance as it leverages CSS rather than JavaScript calculations in applying styles to elements based on structural position .

You might also like