HTML Assignment
HTML Assignment
HTML Assignment
Answer-1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Commerce Courses</title>
</head>
<body>
<table border="1">
<tr>
<td rowspan="11">Commerce</td>
<td rowspan="7">UG</td>
<td>Com. Plain</td>
</tr>
<tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td rowspan="4">PG</td>
</tr>
<tr>
</tr>
<tr>
<td>Com. Accounts</td>
</tr>
<tr>
<td>Com. Management</td>
</tr>
</table>
</body>
</html>
Answer-2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
<style>
body{
font-size: 20px;
}
</style>
</head>
<body>
<fieldset>
<legend> <h2>Student Registration Form</h2></legend>
<form action="#" method="POST">
<label for="fullname">Full Name:</label>
<input type="text" id="fullname" name="fullname" placeholder = "Enter your
name..." required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder = "Enter your
e-mail..." required><br><br>
<label for="pass">Pass-Word:</label>
<input type="password" id = "pass" name ="pass" placeholder = "Enter your
pass_word..." required></input><br><br>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob" required><br><br>
<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male" checked
required>
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br><br>
<label for="address">Address:</label><br>
<textarea id="address" name="address" placeholder = "Start here ..."
required></textarea><br><br>
Answer-3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order-Unorder-List</title>
<style>
</style>
</head>
<body>
<ol>
<li> Animals </li>
</ol>
<ul>
<li>Cow</li>
<li>Cat</li>
<li>Lion</li>
</ul>
<ol type="1" start="2">
<li> Colors</li>
</ol>
<ul>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ul>
</body>
</html>
Answer-4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table</title>
<style>
body {
font-size: 18px;
}
table {
border-collapse: collapse;
width: 100%;
}
td {
border: 1px solid black;
padding: 8px;
text-align: left;
font-weight: bold;
}
th{
border: 1px solid black;
padding: 8px;
text-align: center;
}
</style>
</head>
<body>
<table>
<tr>
<th>
Community
</th>
<th>
Male
</th>
<th>
Female
</th>
</tr>
<tr>
<td>OBC</td>
<td>35</td>
<td>40</td>
</tr>
<tr>
<td>SC/ST</td>
<td>23</td>
<td>12</td>
</tr>
<tr>
<td>GEN</td>
<td>12</td>
<td>10</td>
</tr>
</table>
</body>
</html>
Answer-5
Page with Background Image
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image:C:\Users\hp\Downloads\browser-1666982_1280.png;
background-size: cover;
}
</style>
</head>
<body>
</body>
</html>
Page with Hyperlink
<!DOCTYPE html>
<html>
<head>
<title>Hyperlink Page</title>
</head>
<body>
<a href="background.html">Go to Image Program</a>
</body>
</html>
Answer-6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Department Courses</title>
<style>
body {
font-size: 18px;
}
table {
/* border-collapse: collapse; */
width: 100%;
}
td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
th{
border: 1px solid black;
padding: 8px;
text-align: center;
}
</style>
</head>
<body>
</body>
</html>
Answer-7
<!DOCTYPE html>
<html>
<head>
<title>Multi-Section Layout</title>
<style>
.section {
border: 1px solid black;
margin: 10px;
padding: 10px;
}
#physics {
height: 100px;
}
#welcome {
height: 200px;
}
#maths {
width: 300px;
display: inline-block;
vertical-align: top;
}
#chemistry {
width: 400px;
display: inline-block;
vertical-align: top;
}
#computer {
width:600px;
display: inline-block;
vertical-align: top;
}
</style>
</head>
<body>
<div id="physics" class="section">
<p style="font-size:40pt;color:green">Physics.html</p>
</div>
<div id="welcome" class="section">
<p style="font-size:80pt;color:green;">Welcome.html</p>
</div>
<div id="maths" class="section">
<p style="font-size:30pt;color:green">Maths.html</p>
</div>
<div id="chemistry" class="section">
<p style="font-size:45pt;color:green">Chemistry.html</p>
</div>
<div id="computer" class="section">
<p style="font-size:30pt;color:green">Computer.html</p>
</div>
</body>
</html>
Answer-8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Favorite Teacher</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<style>
body {
background-color: antiquewhite;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.left img{
width : 300px;
height: 200px;
display: inline-block;
}
.container {
display: flex;
justify-content: space-around;
}
.left, .right {
width: 45%;
padding: 20px;
}
.left h1 {
color : red;
}
.vertical-line {
border-left: 2px solid black;
height: 100vh;
}
.right img {
max-width: 100%;
height: auto;
}
</style>
<body>
<div class="container">
<div class="left">
<img src="p1.PNG" alt="back">
<h1><u>My Favorite Teacher</u></h1>
Answer-9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sum of Two Numbers</title>
</head>
<script>
function calculateSum() {
var num1 = parseInt(document.getElementById('num1').value);
var num2 = parseInt(document.getElementById('num2').value);
var sum = num1 + num2;
document.getElementById('result').innerHTML = "Sum: " + sum;
}
</script>
<body>
<script src="script.js"></script>
</body>
</html>
Answer-10
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inline CSS Example</title>
</head>
<body>
<p style="font-family: 'Times New Roman', serif; font-size: 18px; color: green;
font-style: italic;">This text is styled using inline CSS.</p>
Answer-11
<!DOCTYPE html>
<html>
<head>
<title>Signup Form</title>
<script>
function validateForm() {
var username = document.forms["signupForm"]["username"].value;
var password = document.forms["signupForm"]["password"].value;
if (username == "") {
alert("Username must be filled out");
return false;
}
if (password.length < 6) {
alert("Password must be at least 6 characters long");
return false;
}
}
</script>
</head>
<body>
<h2>Signup Form</h2>
</body>
</html>
Answer-12
HTML File
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External CSS Example</title>
<link rel="stylesheet" type="text/css" href="p11.css">
</head>
<body>
<h1>Welcome to My Website</h1>
</body>
</html>
CSS File
body {
background-color: #f0f0f0;
}
h1 {
background-color: #007bff;
color: #ffffff;
padding: 20px;
text-align: center;
}
p{
background-color: #28a745;
color: #ffffff;
padding: 10px;
text-align: center;
}
Answer-13
<!DOCTYPE html>
<html>
<head>
<title>Compare Two Integers</title>
<script>
function displayLarger() {
var num1 = parseInt(prompt("Enter the first integer:", ""));
var num2 = parseInt(prompt("Enter the second integer:", ""));
</body>
</html>
Answer-14
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
</head>
<body>
<form>
<label for="firstName">First Name:</label>
<input type="text" id="firstName" name="firstName" required><br><br>
<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male" checked>
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label><br><br>
<label for="city">City:</label>
<input list="cities" id="city" name="city">
<datalist id="cities">
<option value="New York">
<option value="Los Angeles">
<option value="Chicago">
<option value="Houston">
<option value="Phoenix">
<option value="Philadelphia">
<option value="San Antonio">
<option value="San Diego">
<option value="Dallas">
<option value="San Jose">
</datalist><br><br>
<label for="address">Address:</label><br>
<textarea id="address" name="address" rows="4"
cols="50"></textarea><br><br>
<label for="course">Course:</label>
<select id="course" name="course">
<option value="Engineering">Engineering</option>
<option value="Business">Business</option>
<option value="Medicine">Medicine</option>
<option value="Arts">Arts</option>
</select><br><br>
</body>
</html>
Answer-15
<!DOCTYPE html>
<html>
<head>
<title>Event Example</title>
<script>
function onClickEvent() {
document.getElementById("clickResult").innerHTML = "Button was clicked!";
}
function onMouseMoveEvent() {
document.getElementById("moveResult").innerHTML = "Mouse is moving over
this text!";
}
</script>
</head>
<body>
<h2>JavaScript Events</h2>
</body>
</html>
Answer-16
HTML File
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML with Linked CSS</title>
<link rel="stylesheet" type="text/css" href="16.css">
</head>
<body>
<h1>Welcome to My Website</h1>
</body>
</html>
CSS file
h1 {
color: red;
font-family: Arial, sans-serif;
}
p.Arial {
background-color: gray;
}