Assignment 3 Web Technologies Answers
Assignment 3 Web Technologies Answers
5 Marks Questions
To center a box both horizontally and vertically on a webpage using CSS, follow these steps:
Example CSS:
.container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
.box {
width: 200px;
height: 200px;
background-color: lightblue;
To create a simple form collecting a user's name, email, and message, you can structure the HTML
as follows:
<form>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="message">Message:</label>
<button type="submit">Submit</button>
</form>
form {
width: 300px;
margin: 0 auto;
padding: 20px;
border-radius: 10px;
input, textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border-radius: 5px;
button {
background-color: #4CAF50;
color: white;
padding: 10px;
width: 100%;
border: none;
border-radius: 5px;
10 Marks Questions
Media queries are crucial for designing responsive websites as they allow the layout to adapt to
different screen sizes. This ensures an optimal user experience across devices. For instance, you
.menu {
display: none;
.hamburger {
display: block;
In this example, the .menu is hidden on screens smaller than 600px, and the .hamburger menu is
shown, enhancing responsiveness.
<table>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th>Availability</th>
</tr>
</thead>
<tbody>
<tr>
<td>Product A</td>
<td>$10</td>
<td>In stock</td>
</tr>
<tr>
<td>Product B</td>
<td>$20</td>
<td>Out of stock</td>
</tr>
</tbody>
</table>
width: 100%;
border-collapse: collapse;
td, th {
padding: 10px;
tbody tr:nth-child(odd) {
background-color: #f2f2f2;
20 Marks Questions
Media queries enable developers to create mobile-friendly layouts by targeting specific screen sizes.
.content {
width: 100%;
padding: 10px;
.sidebar {
display: none;
In this case, the .content takes up the full width on mobile screens, and the sidebar is hidden for
better readability on smaller devices.
CSS keyframes can be used to create complex animations. Here's a step-by-step process:
@keyframes slide {
0% {
50% {
100% {
.element {
width: 100px;
height: 100px;
background-color: lightcoral;
This code creates a smooth sliding and scaling animation for the .element.