Ilovepdf Merged
Ilovepdf Merged
Laborartory
Lab Assignment -1
Lab slot - L9 + L10
Submitted on – 9 th February, 2024
HYPER TEXT MARKUP LANGUAGE (HTML)
1) Introduction to HTML
a. Create a webpage that prints your name to the screen.
b. Create a webpage that prints the numbers 1 - 10 to the screen.
c. Create a webpage and set its title to "This is a webpage".
d. Create a webpage that prints the message "When was this webpage created? Check page's
title for the answer." to the screen, and set the title of the page to the current date.
e. Create a webpage that prints any text of your choice to the screen; do not include a head
section in the code.
f. Create a webpage which keeps track of the browsers information and do the following
• refreshes its page in 5 seconds,
• expires in a duration of time
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>This is a webpage</title>
</head>
<body>
<h1>Assessment - 1</h1>
<section>
<h2>1 - a</h2>
<h1>Khushi </h1>
</section>
<section>
<h2>1 - b</h2>
<ul style="list-style: none">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
</section>
<section>
<h2>1 - c</h2>
<div>Title changed</div>
</section>
<section>
<h2>1 - d</h2>
</section>
<section>
<h2>1 - e</h2>
</section>
</body>
</html>
OUTPUT:
Part d
Code:
<!DOCTYPE html>
<html>
<head>
<title>09-01-2023</title>
</head>
<body>
<h2>1 - d</h2>
When was this webpage created?
<br>
Check the title for the answer...!!
</body>
</html>
OUTPUT:
Part e code:
<html>
<body>
<h2>1 - e</h2>
this is a webpage without header
</body>
</html>
OUTPUT:
Partf
Code:
<!DOCTYPE html>
<html>
<head>
<title>ques 1(f)</title>
<meta http-equiv="refresh" content="5">
<meta name="expires" content="Friday, 16-Aug-19 10:36:00 GMT">
</head>
<body>
<h2>1 - f</h2>
hello world!
</body>
</html>
Output:
2) HTMLTEXT EXERCISES
f. Print a paragraph that is a description of a book; include the title of the book as well as its
author. Names and titles should be underlined, adjectives should be italicized and bolded.
g. Print your name to the screen with every letter being a different heading size.
h. Write a comment line on your code and make sure it is not displayed in the page
l. Set the background color of the page as yellow m. Set an image as background of the page
n. Set the font size as 10. Print it. Again try to decrease the font size. Check whether the font size
is reduced.
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.q1 h1{
color: green;
}
.q2 li:nth-child(1){
color: green;
}
.q2 li:nth-child(2){
color: red;
}
.q2 li:nth-child(3){
color: yellow;
}
.q2 li:nth-child(4){
color: blue;
}
.q2 li:nth-child(5){
color: purple;
}
.q2 li:nth-child(6){
color: orange;
}
.q2 li:nth-child(7){
color: magenta;
}
.q2 li:nth-child(8){
color: mediumaquamarine;
}
.q2 li:nth-child(9){
color: gray;
}
.q2 li:nth-child(10){
color: black;
}
.q3 h1{
font-family: Tahoma;
}
.q4 i{
font-weight: bold;
text-decoration: underline;
}
.q5 .i1{
font-family: Agency FB;
}
.q5 .i2{
font-family: Arial Narrow;
}
.q5 .i3{
font-family: Bahnschrift;
}
.q5 .i4{
font-family: Arial Rounded MT Bold;
}
.q6 i{
font-style: italic;
text-decoration: underline;
}
.q7 div{
display: flex;
}
.q12{
height: 100vh;
background: yellow;
}
.q13{
background-image: url("../Ques-04/image/image4.jpg");
height: 100vh;
}
/*.q14 div{*/
/* font-size: 10px;*/
/*}*/
.q14 div{
font-size: 8px;
}
</style>
</head>
<body>
<section class="q1">
<h2>2 - a</h2>
<h1>Khushi</h1>
</section>
<section class="q2">
<h2>2 - b</h2>
<ul style="list-style: none">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
</section>
<section class="q3">
<h2>2 - c</h2>
<h1>Khushi Singh</h1>
</section>
<section class="q4">
<h2>2 - d</h2>
<h1><i>Khushi</i>Singh</h1>
</section>
<section class="q5">
<h2>2 - e</h2>
<p>
<i class="i1">Lorem Ipsum is simply dummy text of the printing and
typesetting</i>
<i class="i2">industry. Lorem Ipsum has been the industry's standard dummy
text</i>
<i class="i3">ever since the 1500s, when an unknown printer took a galley of
type</i>
<i class="i4">and scrambled it to make a type specimen book. It has survived
not</i>
</p>
</section>
<section class="q6">
<h2>2 - f</h2>
<p>
<i>Thomas Sawyer</i> is the titular character of the <i>Mark Twain</i>
novel <i>The Adventures of Tom Sawyer (1876)</i>. He appears in three other
novels by Twain: Adventures of Huckleberry Finn (1884),<i> Tom Sawyer
Abroad (1894)</i>, and Tom Sawyer, Detective (1896).
</p>
</section>
<section class="q7">
<h2>2 - g</h2>
<div>
<h1>A</h1>
<h2>r</h2>
<h3>n</h3>
<h4>a</h4>
<h5>b</h5>
<h6>G</h6>
</div>
</section>
<section class="q8">
<h2>2 - h</h2>
<!-- <div>Comment</div>-->
</section>
<section class="q9">
<h2>2 - i</h2>
<p>
a <sup>2</sup> + b<sup>2</sup> = 2ab
</p>
</section>
<section class="q10">
<h2>2 - j</h2>
<p>
H<sub>2</sub>O
</p>
</section>
<section class="q11">
<h2>2 - k</h2>
<div>
<pre>
#include "stdio.h"
int main{
printf("Hello world");
return 0;
}
</pre>
</div>
</section>
<section class="q12">
<h2>2 - l</h2>
</section>
<section class="q13">
<h2>2 - m</h2>
</section>
<section class="q14">
<h2>2 - n</h2>
<div>
Khushi
</div>
</section>
<section class="q15">
<h2>2 - o</h2>
<marquee attribute_name = "attribute_value">
Khushi
</marquee>
</section>
<section class="q16">
<h2>2 - p</h2>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
</section>
</body>
</html>
OUTPUT:
3) HTML TEXT FORMATTING, LISTS EXERCISES
a. Print the squares of the numbers 1 - 20. Each number should be on a separate line, next to
it the number 2 superscripted, an equal sign and theresult.
b. Prints 10 names with a line break between each name. The list should be alphabetized, and
to do this place a subscripted number next to each name based on where it will go in the
alphabetized list. (Example: Alan1). Print first, the unalphabetized list with a subscript
number next to each name, then the alphabetized list. Both lists should have an
level heading.
c. Print two lists with any information you want. One list should be an ordered list, the other
list should be an unordered list
d. Print a list which starts with 7 with the type i
e. Prints an h1 level heading followed by a horizontal line whose width is 100%. Below the
horizontal line print a paragraph relating to the text in the heading.
f. Print a definition list with 5 items
g. Print two addresses in the same format used on the front of envelopes (senders address in
top left corner, receivers address in the center)
h. Print ten acronyms and abbreviations of your choosing, each separated by two lines.
Specify the data that the abbreviations and acronymsrepresent
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question - 3</title>
</head>
<body>
<!-- a. Print the squares of the numbers 1 - 20. Each number should be on a
separate line,
next to it the number 2 superscripted, an equal sign and theresult. -->
<div>
<p>1<sup>2</sup> = 1</p>
<p>2<sup>2</sup> = 4</p>
<p>3<sup>2</sup> = 9</p>
<p>4<sup>2</sup> = 16</p>
<p>5<sup>2</sup> = 25</p>
<p>6<sup>2</sup> = 36</p>
<p>7<sup>2</sup> = 49</p>
<p>8<sup>2</sup> = 64</p>
<p>9<sup>2</sup> = 81</p>
<p>10<sup>2</sup> = 100</p>
<p>11<sup>2</sup> = 121</p>
<p>12<sup>2</sup> = 144</p>
<p>13<sup>2</sup> = 169</p>
<p>14<sup>2</sup> = 196</p>
<p>15<sup>2</sup> = 225</p>
<p>16<sup>2</sup> = 256</p>
<p>17<sup>2</sup> = 289</p>
<p>18<sup>2</sup> = 324</p>
<p>19<sup>2</sup> = 361</p>
<p>20<sup>2</sup> = 400</p>
</div>
<!-- b. Prints 10 names with a line break between each name. The list should
be
alphabetized, and to do this place a subscripted number next to each name
based on
where it will go in the alphabetized list. (Example: Alan1). Print first, the
unalphabetized list with a subscript number next to each name, then the
alphabetized list. Both lists should have an <h1> level heading. -->
<h1>Unalphabetized list</h1>
Liam<sub>5</sub>
<br/>
Noah<sub>7</sub>
<br/>
Oliver<sub>8</sub>
<br/>
Elijah<sub>2</sub>
<br/>
Yuktika<sub>4</sub>
<br/>
James<sub>10</sub>
<br/>
William<sub>1</sub>
<br/>
Benjamin<sub>6</sub>
<br/>
Lucas<sub>3</sub>
<br/>
Henry<sub>9</sub>
<h1>Alphabetized list</h1>
<p>Benjamin</p>
<p>Elijah</p>
<p>Henry</p>
<p>James</p>
<p>Liam</p>
<p>Lucas</p>
<p>Noah</p>
<p>Oliver</p>
<p>Theodore</p>
<p>William</p>
<br><br>
<!-- c. Print two lists with any information you want. One list should be an
ordered list,
the other list should be an unordered list -->
<b>An unordered nested list:</b>
<ol type="I">
<li>Headings</li>
<li>Basic Text Sections</li>
<li>Lists</li>
<li>
<ol type="A">
<li>Ordered</li>
<li>
<ol type="1">
<li>The ol tag</li>
<li>
<ol type="a">
<li>TYPE</li>
<li>START</li>
<li>COMPACT</li>
</ol>
</li>
<li>The LI tag</li>
</ol>
</li>
<li>Unordered</li>
<li>
<ol type="1">
<li>The UL tag</li>
<li>The LI tag</li>
</ol>
</li>
<li>Definition</li>
<li>
<ol type="1">
<li>The DL tag</li>
<li>The DT tag</li>
<li>The DD tag</li>
</ol>
</li>
</ol>
</li>
<li>Miscellaneous</li>
</ol>
<br><br>
<!-- d. Print a list which starts with 7 with the type i -->
<ol type="a" start="7">
<li>seventh item</li>
<li>eighth item</li>
<li>ninth item</li>
</ol>
<br><br>
<!-- e. Prints an h1 level heading followed by a horizontal line whose width
is 100%.
Below the horizontal line print a paragraph relating to the text in the
heading. -->
<h1>Cricket 2011</h1>
<hr style="width: 100%">
<p>India won world cup in 2011</p>
<br><br>
<!-- f. Print a definition list with 5 items -->
<dl>
<dt>HTML</dt>
<dd>is a markup language</dd>
<dt>Java</dt>
<dd>is a programming language and platform</dd>
<dt>JavaScript</dt>
<dd>is a scripting language</dd>
<dt>SQL</dt>
<dd>is a query language</dd>
</dl>
<br><br>
<!-- g. Print two addresses in the same format used on the front of envelopes
(senders
address in top left corner, receivers address in the center) -->
<address>
8, Lokseva Chawl, New Link Rd, Opp Anand Nagar, Oshiwara, Jogeshwari (west)
<br>
Mumbai, Maharashtra, 400102 <br>
India
</address>
<br/><br/>
<address style="text-align: center;margin: 1rem auto;">
8, Lokseva Chawl, New Link Rd, Opp Anand Nagar, Oshiwara, Jogeshwari (west)
<br>
Mumbai, Maharashtra, 400102 <br>
India
</address>
<!-- h. Print ten acronyms and abbreviations of your choosing, each separated
by two
lines. Specify the data that the abbreviations and acronymsrepresent -->
<abbr title="Information Technology">IT</abbr>
<br/><br/>
<abbr title="Computer Science">CS</abbr>
<br/><br/>
<abbr title="Data Structure and Algorithms">DSA</abbr>
<br/><br/>
<abbr title="Data Base Management System">DBMS</abbr>
<br/><br/>
<abbr title="Electronics and Communication Engineering">ECE</abbr>
<br/><br/>
<abbr title=" Bachelor of Technology">B.Tech</abbr>
<br/><br/>
<abbr title="Indian Institute of Technology">IIT</abbr>
<br/><br/>
<abbr title="Hyper Text Markup Language">HTML</abbr>
<br/><br/>
</body>
</html>
OUTPUT:
4) HTML IMAGE EXERCISES
a. Display five different images. Skip two lines between each image. Each image should
have a title.
b. Display an image that has a border ofsize 2, a width of 200, and a height of 200.
c. Display the image towards the right corner of thewebpage
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Question - 4</title>
<style>
img {
width: 60rem;
}
.qb img {
border: solid yellow 2px;
width: 200px;
height: 200px;
}
.qc img {
float: right;
}
</style>
</head>
<body>
<section class="qa">
<h2>Question - 4(a)</h2>
<figure>
<img src="valley.png" alt="valley"/>
<figcaption>
valley
</figcaption>
</figure>
<br>
<br>
<figure>
<img src="space.png" alt="space"/>
<figcaption>
space
</figcaption>
</figure>
<br>
<br>
<figure>
<img src="horse.png" alt="Rider">
<figcaption>
Rider
</figcaption>
</figure>
<br>
<br>
<figure>
<img src="someething.png" alt="something.jpg">
<figcaption>
something
</figcaption>
</figure>
<br>
<br>
<figure>
<img src="hand.png" alt="hand">
<figcaption>
Hand
</figcaption>
</figure>
<br>
<br>
</section>
<section class="b-part">
<h2>Question - 4(b)</h2>
<img src="track.png" alt="road.jpg">
</section>
<section class="c-part">
<h2>Question - 4(c)</h2>
<img src="superman.png" alt="Transformer.jpg">
</section>
</body>
</html>
OUTPUT:
5) HTML TABLES
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 5 - HTML Tables</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
}
img {
width: 8rem;
}
table {
margin: auto
}
thead, tfoot {
text-align: center;
font-weight: 700;
}
table, th, td {
border: 1px solid;
padding: .25rem;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th colspan="4">Purchased Equipments (June, 2006)</th>
<th rowspan="3">New Column</th>
</tr>
<tr>
<th rowspan="2">Item Num#</th>
<th rowspan="2">Item Picture</th>
<th>Item Description</th>
<th>Price</th>
</tr>
<tr>
<th>Shipping Handling, Installation, etc</th>
<th>Expense</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">1.</td>
<td rowspan="2"><img src="computer.png" alt="computer.png"></td>
<td>IBM Clone Computer</td>
<td>$ 400.00</td>
<td rowspan="2">New Column data</td>
</tr>
<tr>
<td>Shipping Handling, Installation, etc</td>
<td>$ 20.00</td>
</tr>
<tr>
<td rowspan="2">2.</td>
<td rowspan="2"><img src="chip.png" alt="microchip.png"></td>
<td>1GB RAM Module for Computer</td>
<td>$ 50.00</td>
<td rowspan="3">New Column data</td>
</tr>
<tr>
<td>Shipping Handling, Installation, etc</td>
<td>$ 14.00</td>
<!-- <td>New Column data</td>-->
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">Purchased Equipments (June, 2006)</td>
</tr>
</tfoot>
</table>
</body>
</html>
OUTPUT:
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<form action="" style="margin: 0; padding: 0;">
<table style= "border: solid black 1px;">
<tr style="background-color: grey;">
<td colspan="2"><center>The World of Fruit</center></td>
</tr>
<tr>
<td colspan="2"><center>Fruit Survey</center></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="" id="" /></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="" id="" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="" id="" /></td>
</tr>
<tr>
<td>How many pieces of fruit <br> do you eat per day</td>
<td>
<input type="radio" name="" id="" /> 0 <br />
<input type="radio" name="" id="" /> 1 <br />
<input type="radio" name="" id="" /> 2 <br />
<input type="radio" name="" id="" /> More than 2 <br />
</td>
</tr>
<tr>
<td>My favurite fruit</td>
<td>
<select name="" id="" scrolling="yes">
<option value="">Apple</option>
<option value="">Banana</option>
<option value="">Plum</option>
<option value="">Pomegrante</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
Would You like a brochure
</select>
</td>
</tr>
<tr>
<td>Would you like a <br> brochure</td>
<td><input type="checkbox" name="" id="" /></td>
</tr>
<tr>
<td colspan="2"><center><input type="button" value="Submit"></center></td>
</tr>
</table>
</form>
</body>
</html>
OUTPUT:
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 7 - Frames</title>
<style>
body {
min-height: 100vh;
background-image: url("images/background.jpg");
background-size: 60%;
}
iframe {
width: 100%;
height: 100%;
}
main {
height: 100vh;
display: grid;
grid-template-columns: 1fr 2fr;
grid-template-rows: 1fr 4fr;
grid-auto-rows: 1fr;
}
ul {
list-style: none; /* Remove default bullets */
}
ul li::before {
content: "\2022"; /* Add content: \2022 is the CSS Code/unicode for a bullet
*/
color: blue; /* Change the color */
font-weight: bold; /* If you want it to be bold */
display: inline-block; /* Needed to add space between the bullet and the text
*/
width: 1em; /* Also needed for space (tweak if needed) */
margin-left: -1em; /* Also needed for space (tweak if needed) */
}
li {
margin-top: 2rem;
font-weight: 700;
}
.list {
text-transform: uppercase;
color: red;
font-size: 1.5rem;
text-decoration: underline;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 4rem;
}
</style>
</head>
<body>
<main>
<iframe style="grid-column: span 2" src="./amazonBookWorld.html"></iframe>
<div class="list">
<ul>
<li>User Login</li>
<li>User Profile</li>
<li>Books Catalog</li>
<li>Shopping Cart</li>
<li>Order Conformation</li>
<li>Payment</li>
</ul>
</div>
<iframe src="./userProfile.html"></iframe>
</main>
</body>
</html>
amazonBookWorld.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Amazon Book World</title>
<style>
h1 {
text-transform: uppercase;
color: red;
}
body {
background-image: url("images/question.png");
background-size: 5rem;
height: 256px;
background-color: #fff;
}
h1 {
text-align: center;
font-size: 3rem;
}
</style>
</head>
<body>
<h1>Amazon Book World</h1>
</body>
</html>
userProfile.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>User's Profile</title>
<style>
:root {
font-size: 1.1rem;
}
* {
box-sizing: border-box;
}
a:link {
color: darkviolet;
font-weight: 700;
}
header, footer {
text-align: center;
color: darkviolet;
}
body {
background-color: #98cefd;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
}
footer {
margin-top: 2rem;
font-size: 1.5rem;
}
main {
margin: auto;
}
table, td, th {
border: solid 4px whitesmoke;
padding: .75rem .5rem;
background-color: #bfbfbf;
}
table {
border: 10px outset whitesmoke;
margin-top: 2rem;
margin-bottom: 2rem;
border-collapse: collapse;
}
</style>
</head>
<body>
<header>
<h1>User's Profile</h1>
</header>
<main>
<table>
<thead>
<tr>
<th>S. no</th>
<th>User name</th>
<th>DOB</th>
<th>Address</th>
<th>Occupation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Ramu P</td>
<td>12th Jan 1980</td>
<td>H No: 22/12/1, M.G.Road, Vij</td>
<td>Engineer</td>
</tr>
<tr>
<td>2</td>
<td>Mohan R.</td>
<td>23rd May 1982</td>
<td>H.No: 22/12/11, Patel Road, Hyd.</td>
<td>Driver</td>
</tr>
<tr>
<td>3.</td>
<td>Pavani V</td>
<td>27th July 1983</td>
<td>H. no: 12/25, Ameerpet, Hyd.</td>
<td>Software Engineer</td>
</tr>
<tr>
<td>4.</td>
<td>Seshu D</td>
<td>07th March 1984</td>
<td>H No:1/99, S.R.Nagar, Hyd</td>
<td>DBA</td>
</tr>
<tr>
<td>5.</td>
<td>Surendra</td>
<td>29rd May 1982</td>
<td>H No: 22/12/11, Bala Nagar, Hyd.</td>
<td>Professor</td>
</tr>
</tbody>
</table>
</main>
<footer>
<a href="#">Home</a>
</footer>
</body>
</html>
OUTPUT:
8) Create an external style sheet named as “external.css” and provide some styles for h2,
p and body tags. Create an html file named as “welcome.html” and link the external style
sheet. Include internal style sheet for body tags. Include a
tags with inline style sheet.
CODE:
Html code
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 8 - Welcome</title>
<link rel="stylesheet" href="external.css">
<style>
body {
background-color: #888888;
color: #000000;
}
</style>
</head>
<body>
<main>
<img src="tree.png" alt="tree-picture">
<div style="margin-right: 4rem;">
<div class="greet">
<h2>Hello World!</h2>
<p style="padding-left: 2.75rem;">
This example contains some advance CSS methods you may not have
learned yet. But, we will explain these methods in a later chapter in the
tutorial
</p>
</div>
<div class="some-text">
<p>This is some text in a paragraph</p>
</div>
</div>
</main>
</body>
</html>
Css code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
}
h2 {
font-size: 2rem;
}
main {
display: flex;
gap: 1rem;
}
p {
padding: .25rem .75rem;
}
.some-text {
border-width: 3px;
border-style: dotted solid dashed solid;
}
.greet {
background-color: #e3e3e3;
margin-top: 2rem;
margin-right: .75rem;
margin-bottom: 2rem;
padding: 2rem 2rem;
}
OUTPUT:
9) Write the CSS code necessary to recreate the following appearance on-screen, exactly as
shown.
The menu items (Summaryto Trailers and Videos) are white text on a black background.
There is 20px space between the words and the right and left sides of their black boxes.
• The movie rating has a green background and white text. The number is in 30pt font. There is
20px space between the number and the edges of the green background. There is 5px blank
space around the green background.
• The background color of the page is gray but the background color of the area containing
everything is white. The white area is 80% wide and centered. There is 20px of space between
the edge of the white background and everything inside it.
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 9 - CSS</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: gray;
}
header {
padding: 5rem 2rem 5rem;
font-size: 1.75rem;
text-align: center;
}
img {
width: 100%;
}
main {
margin: auto 3rem auto;
}
nav > ul {
list-style: none;
display: flex;
justify-content: start;
gap: 3px;
}
nav > ul > li {
background-color: hsl(0, 0%, 0%);
padding: .5rem 20px;
color: white;
}
nav > ul > li:hover {
background-color: #595959;
color: black;
}
p:first-child {
font-size: 1.2rem;
margin-bottom: 2rem;
}
nav {
margin-bottom: 2rem;
text-align: center;
}
section {
background-color: white;
margin: 1rem 3rem;
padding-bottom: 5rem;
}
.movie-details {
display: grid;
grid-template-columns: .75fr 8.75rem 3fr;
grid-gap: 1.25rem;
}
.rating {
color: white;
background-color: #027f02;
font-size: 30pt !important;
padding: 20px;
margin: 5px;
text-align: center;
/*font-size: 3rem !important;*/
/*padding: 2.5rem;*/
/*margin: 5px;*/
/*width: 50%;*/
}
.description {
width: 80%;
}
.description > * {
margin-bottom: 1.5rem;
}
.description > ul {
padding-left: 2.5rem;
width: 60%;
}
</style>
</head>
<body>
<section>
<header>
<h1>WALL - E</h1>
</header>
<main>
<p>Walt Disney Studios Motion Pictures | Release date: Jun 27, 2008</p>
<nav>
<ul>
<li>Summary</li>
<li>Critic Reviews</li>
<li>User Reviews</li>
<li>Details and Credits</li>
<li>Trailers and Videos</li>
</ul>
</nav>
<div class="movie-details">
<img src="waller.png" alt="walle-poster.jpg">
<div>
<p class="rating">94</p>
</div>
<div class="description">
<h3>Metascore</h3>
<p>Universal acclaim <br>
based on 39 Critics</p>
<ul>
<li>Starring: Ben Burtt, Elissa Knight, Jeff Garlin</li>
<li>Summary: After hundreds of lonely years of doing what he was built for
, Wall-E discovers a new purpose in life when he meets a sleek search
robot named EVE. [Walt Disney Pictures]
</li>
</ul>
</div>
</div>
</main>
</section>
</body>
</html>
OUTPUT:
10) Write the HTML and CSS box model to recreate the following appearance. No manual line
breaks have been inserted
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 10 - Broad Band Price Table</title>
<style>
@import
url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=O
pen+Sans:wght@400;700&display=swap');
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
header {
font-family: 'Montserrat', sans-serif;
font-size: 2rem;
margin: 3rem auto;
}
body {
color: white;
font-family: 'Open Sans', sans-serif;
background-image: url("bc.jpg");
text-align: center;
}
button {
margin-top: 1rem;
padding: 1rem 3rem;
border: none;
border-radius: .15rem;
color: inherit;
font-weight: 700;
font-size: 1rem;
text-transform: uppercase;
}
footer {
margin-top: 5rem;
}
footer a:link {
color: green;
text-decoration: none;
}
footer a:hover {
color: green;
text-decoration: underline;
}
main {
display: flex;
gap: 1rem;
justify-content: center;
margin: auto;
flex-wrap: wrap;
}
svg {
width: 1.2rem;
fill: white;
}
.card {
border-radius: .1rem;
overflow: hidden;
border: solid 1px grey;
margin-top: 2rem;
min-width: 20%;
padding-bottom: 3rem;
background-color: rgba(0, 0, 0, 35%);
}
.card-1 > .heading, .card-1 button {
background-color: hsl(9, 92%, 61%);
}
.card-2 > .heading, .card-2 button {
background-color: hsl(326, 61%, 49%);
}
.card-3 > .heading, .card-3 button {
background-color: hsl(165, 60%, 47%);
}
.card-1 button:hover {
background-color: hsl(9, 92%, 72%);
}
.card-2 button:hover {
background-color: hsl(326, 61%, 60%);
}
.card-3 button:hover {
background-color: hsl(165, 60%, 58%);
}
.heading {
padding: 2.5rem 4rem;
font-size: 1.5rem;
font-weight: bolder;
}
.description {
padding: 3.5rem 1.5rem 2rem;
list-style: none;
}
.description li {
display: flex;
justify-content: start;
gap: 1rem;
margin-top: 1rem;
padding-left: 20%;
letter-spacing: .1em;
}
</style>
</head>
<body>
<header>
<h1>Broad band price table</h1>
</header>
<main>
<div class="card card-1">
<div class="heading">
Standard
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button>Get Started</button>
</div>
<div class="card card-2">
<div class="heading">
Enhanced
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button>Get Started</button>
</div>
<div class="card card-3">
<div class="heading">
Unlimited
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button>Get Started</button>
</div>
</main>
<footer>
<p>Ⓒ️ 2018 Broad Band Price Table. All rights reserved | Design by <a
href="#">W3layouts</a></p>
</footer>
</body>
</html>
OUTPUT:
11) Design the following web page using HTML5 and CSS:
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-
scale=1.0, minimumscale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Question 11 - Zoror</title>
<link rel="stylesheet" href="styles.css">
<style>
</style>
</head>
<body>
<header>
<h1 style="grid-column: span 2">
<img class="logo" src="zletter.png" alt="letter-z.png">
<span style="margin-left: 1rem;">Zoror</span>
</h1>
<p>Travel diaries</p>
<nav class="uppercase">
<ul>
<li>Home</li>
<li>Blog</li>
<li>Resume</li>
<li>Contact</li>
</ul>
</nav>
</header>
<main>
<div class="something">
<img src="wallpaper.png" alt="GoldenGateBridge.jpeg">
<div class="caption">
<p>Reflections on my holiday in the United States...</p>
<button>See article ▶️</button>
</div>
</div>
<section>
<article>
<div style="display: flex;gap: 2rem;vertical-align: center">
<img class="logo" style="width: 4rem" src="bfly.png" alt="logo.png">
<h1 class="uppercase" style="padding: 1rem 1px; font-size:2rem;">
I'm a great traveller
</h1>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et
dolore magna aliqua. Id diam vel quam elementum pulvinar etiam non quam
lacus. Sit amet massa
vitae
tortor condimentum lacinia quis. Leo vel fringilla est ullamcorper eget nulla
facilisi etiam. Vel elit
scelerisque mauris pellentesque pulvinar pellentesque. Amet justo donec enim
diam. Tristique magna
sit
amet purus gravida. Interdum varius sit amet mattis. Tellus integer feugiat
scelerisque varius morbi. A
iaculis at erat pellentesque adipiscing commodo. Purus semper eget duis at
tellus at urna
condimentum
mattis. Etiam sit amet nisl purus in. Quam quisque id diam vel quam. Lectus
magna fringilla urna
porttitor rhoncus dolor. Elementum nisi quis eleifend quam adipiscing vitae.
</p>
<p>
Faucibus pulvinar elementum integer enim neque volutpat ac tincidunt. Odio
tempor orci dapibus
ultrices
in iaculis. Odio facilisis mauris sit amet. Vitae sapien pellentesque
habitant morbi. Accumsan sit amet
nulla facilisi morbi tempus iaculis. Adipiscing tristique risus nec feugiat
in fermentum posuere urna.
Suspendisse potenti nullam ac tortor vitae. Donec ac odio tempor orci dapibus
ultrices in. Non sodales
neque sodales ut. Amet cursus sit amet dictum sit amet. Elementum eu
facilisis sed odio morbi quis.
Tortor vitae purus faucibus ornare suspendisse sed nisi. Curabitur vitae nunc
sed velit dignissim
sodales ut eu sem. Nibh sit amet commodo nulla facilisi nullam vehicula. At
tellus at urna condimentum
mattis pellentesque id. Magna eget est lorem ipsum dolor sit amet. Sit amet
facilisis magna etiam.
</p>
<p>
Urna cursus eget nunc scelerisque viverra. Justo eget magna fermentum iaculis
eu non diam
phasellus.
Malesuada pellentesque elit eget gravida cum sociis. In massa tempor nec
feugiat. Ipsum suspendisse
ultrices gravida dictum fusce. Aliquam ultrices sagittis orci a scelerisque
purus semper eget.
Consectetur lorem donec massa sapien faucibus et molestie ac feugiat. Id
ornare arcu odio ut sem
nulla
pharetra diam sit. Ultricies tristique nulla aliquet enim tortor at. Id donec
ultrices tincidunt arcu
non sodales. Consequat mauris nunc congue nisi vitae suscipit tellus mauris.
Pellentesque habitant
morbi
tristique senectus. Turpis massa sed elementum tempus egestas sed. Fermentum
iaculis eu non diam
phasellus vestibulum lorem sed risus. Eget aliquet nibh praesent tristique
magna. Elit sed vulputate mi
sit amet mauris commodo quis. Quam nulla porttitor massa id. Eu volutpat odio
facilisis mauris sit
amet.
</p>
</article>
<aside>
<h2 class="uppercase">About the Author</h2>
<img class="profile-pic" src="images/cow.png" alt="profile-pic.png">
<div class="description">
<p>
Let me introduce myself: My name's Zozor. I was born on 23 November, 2005
</p>
<p>
A bit meager, is it not? This is why I've now decided to write my biography
to let my
headers know who I really am.
</p>
</div>
<div class="socials">
<img src="images/facebook.png" alt="facebook.png">
<img src="images/twitter.png" alt="twitter.png">
<img src="images/vimeo.png" alt="vimeo.png">
<img style="background-color: #efefe7; padding: .75rem;"
src="images/flickr.png" alt="flicker.png">
<img src="images/rss.png" alt="rss.png">
</div>
</aside>
</section>
</main>
<footer>
<div>
<h3 class="uppercase">My last tweet</h3>
<p style="margin-top: 2rem;">Hee haw!</p>
<p style="margin-top: 2rem;">12/05 23:12</p>
</div>
<div>
<h3 class="uppercase">My pictures</h3>
<div class="pictures">
<img src="images/nighttime.jpeg" alt="night-time.jpeg">
<img src="images/india.jpg" alt="india scene.jpg">
<img src="images/the-golden-dome-jenny-regan.jpg" alt="the-golden-dome-
jenny.jpg">
<img src="images/statue%20of%20liberty.JPEG" alt="statue-of-liberty.JPEG">
</div>
</div>
<div>
<h3 class="uppercase">My friends</h3>
<div style="margin-top: 2rem">
<ul>
<li>Pupi the rabbit</li>
<li>Ji</li>
<li>My Baobab</li>
<li>Super cucumber</li>
<li>Kaiwaii</li>
<li>Prince</li>
<li>Perceval.eu</li>
<li>Mr Fan</li>
</ul>
</div>
</div>
</footer>
</body>
</html>
OUTPUT:
12) Design a web page with HTML and bootstrap tags to the following components:
• List a few vegetables and fruits using the bootstrap dl tag • Display one of your previous code
using tag
• List 10 shortcut keys of Microsoft word with the highlighted background.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ques-5</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
"
integrity="sha384-
Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<style>
.key{
padding: 1rem ;
background-color: grey;
border: 1px solid black;
border-radius: 0.75rem;
}
dd{
margin: 2rem;
}
.keys{
margin-bottom: 2rem;
}
</style>
</head>
<body>
<div class="container">
<div id="vegetables">
<h2>Vegetables</h2>
<dl>
<dt>Carrots</dt>
<dt>Broccoli</dt>
<dt>Mushrooms</dt>
<dt>Kale</dt>
<dt>Turnips</dt>
<dt>Bell Peppers</dt>
<dt>Asparagus</dt>
<dt>Cauliflower</dt>
<dt>Green Beans</dt>
<dt>Beets</dt>
<dt>Onions</dt>
<dt>Tomatoes</dt>
<dt>Eggplant</dt>
<dt>Sweet Potato</dt>
</dl>
</div>
<div id="fruits" class="mt-5">
<h2>Fruits</h2>
<dl>
<dt>Lemons.</dt>
<dt>Strawberries</dt>
<dt>Oranges</dt>
<dt>Limes</dt>
<dt>Grapefruit</dt>
<dt>Blackberries</dt>
<dt>Apples</dt>
<dt>Pomegranate</dt>
</dl>
</div>
<h2 class="mt-5">Code</h2>
<code>#include<stdio.h><br>int main(void) { <br>printf("Hello
World\n");<br>return 0; <br>}</code>
<div id="shortcut-keys" class="mt-5 keys">
<h2>Shortcut Keys</h2>
<dl>
<dt><span class="key">Ctrl</span> + <span class="key">F</span></dt>
<dd>Finds the occurrence of text in the document</dd>
<dt><span class="key">Ctrl</span> + <span class="key">H</span></dt>
<dd>Finds and replace the desired text with the given text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">B</span></dt>
<dd>Bolds the text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">I</span></dt>
<dd>Italicizes the text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">U</span></dt>
<dd>Underlines the text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">Shift</span> + <span
class="key">></span></dt>
<dd>Increases the font size</dd>
<dt><span class="key">Ctrl</span> + <span class="key">Shift</span> + <span
class="key"><</span></dt>
<dd>Decreases the font size</dd>
<dt><span class="key">Ctrl</span> + <span class="key">A</span></dt>
<dd>Selects all text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">C</span></dt>
<dd>Copies the text</dd>
<dt><span class="key">Ctrl</span> + <span class="key">X</span></dt>
<dd>Cuts the text</dd>
</dl>
</div>
</div>
</body>
</html>
OUTPUT:
13) Apply the container and fluid-container of bootstrap to display the poster mentioned in
question number 10.
CODE:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ques-8</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-
rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
crossorigin="anonymous">
<style>
@import
url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=O
pen+Sans:wght@400;700&display=swap');
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
header {
font-family: 'Montserrat', sans-serif;
font-size: 2rem;
margin: 3rem auto;
}
body {
color: white;
font-family: 'Open Sans', sans-serif;
background-image: url("bc.jpg");
text-align: center;
}
button {
margin-top: 1rem;
padding: 1rem 3rem;
border: none;
border-radius: .15rem;
color: inherit;
font-weight: 700;
font-size: 1rem;
text-transform: uppercase;
}
footer {
margin-top: 5rem;
}
footer a:link {
color: green;
text-decoration: none;
}
footer a:hover {
color: green;
text-decoration: underline;
}
main {
display: flex;
gap: 1rem;
justify-content: center;
margin: auto;
flex-wrap: wrap;
}
svg {
width: 1.2rem;
fill: white;
}
.card {
border-radius: .1rem;
overflow: hidden;
border: solid 1px grey;
margin-top: 2rem;
min-width: 20%;
padding-bottom: 3rem;
background-color: rgba(0, 0, 0, 35%);
}
.card-1 > .heading, .card-1 button {
background-color: hsl(9, 92%, 61%);
}
.card-2 > .heading, .card-2 button {
background-color: hsl(326, 61%, 49%);
}
.card-3 > .heading, .card-3 button {
background-color: hsl(165, 60%, 47%);
}
.card-1 button:hover {
background-color: hsl(9, 92%, 72%);
}
.card-2 button:hover {
background-color: hsl(326, 61%, 60%);
}
.card-3 button:hover {
background-color: hsl(165, 60%, 58%);
}
.heading {
padding: 2.5rem 4rem;
font-size: 1.5rem;
font-weight: bolder;
}
.description {
padding: 3.5rem 1.5rem 2rem;
list-style: none;
}
.description li {
display: flex;
justify-content: start;
gap: 1rem;
margin-top: 1rem;
padding-left: 20%;
letter-spacing: .1em;
}
</style>
</head>
<body>
<header>
<h1>Broad band price table</h1>
</header>
<main class="container-fluid">
<div class="card card-1">
<div class="heading">
Standard
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button class="">Get Started</button>
</div>
<div class="card card-2">
<div class="heading">
Enhanced
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button class="">Get Started</button>
</div>
<div class="card card-3">
<div class="heading">
Unlimited
</div>
<ul class="description">
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-
12.5-32.8-12.5-
45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5
12.5-32.8 0-45.3s-32.8-12.5-
45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64
64H448c35.3 0 64-28.7 64-
64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5
352H64zM432 456c-13.3 0-24-
10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/>
</svg>
<span>Unlimited Download</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3
32
32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-
32 32-32zM0
192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8
7.2 16 16 16h32c8.8 0
16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2
16 16 16h32c8.8 0 16-7.2
16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16
16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16
16h32c8.8 0 16-7.2 16-
16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/>
</svg>
<span>20GB Storage</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512
114.6 512
256zM320 352c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24
24V292.7c-23.5 9.5-40 32.5-40
59.3c0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176c17.7 0 32-14.3 32-32s-14.3-
32-32-32s-32 14.3-32 32s14.3
32 32 32zm-16 80c0-17.7-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32s32-14.3 32-
32zm288 32c17.7 0 32-14.3
32-32s-14.3-32-32-32s-32 14.3-32 32s14.3 32 32 32zM400 144c0-17.7-14.3-32-32-
32s-32 14.3-32 32s14.3 32
32 32s32-14.3 32-32z"/>
</svg>
<span>Unlimited Speed</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com
License -
https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons,
Inc. -->
<path d="M64 32C28.7 32 0 60.7 0 96v64c0 35.3 28.7 64 64 64H448c35.3 0 64-
28.7 64-64V96c0-
35.3-28.7-64-64-64H64zM344 152c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24
24s-10.7 24-24 24zm96-
24c0 13.3-10.7 24-24 24s-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24zM64 288c-
35.3 0-64 28.7-64 64v64c0
35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V352c0-35.3-28.7-64-64-64H64zM344
408c-13.3 0-24-10.7-24-
24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24zm104-24c0 13.3-10.7 24-24 24s-
24-10.7-24-24s10.7-24 24-
24s24 10.7 24 24z"/>
</svg>
<span>30 Domains</span>
</li>
</ul>
<button class="">Get Started</button>
</div>
</main>
<footer>
<p>Ⓒ️ 2018 Broad Band Price Table. All rights reserved | Design by <a
href="#">W3layouts</a></p>
</footer>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min
.js"
integrity="sha384-
kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
crossorigin="anonymous"></script>
</body>
</html>
OUTPUT:
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
"
integrity="sha384-
Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
</head>
<body>
<div class="fluid-container">
<div class="row justify-content-center">
<div class="h1">Pricing</div>
</div>
<div class="card-deck text-center">
<div class="card ">
<div class="card-header">
<h5 class="card-title">Free</h5>
</div>
<div class="card-body">
<p class="card-text">
<div class="d-flex flex-row justify-content-center">
<h1 class=" d-flex font-weight-bold">$10</h1><h3 class="font-weight-light">/
mo</h3>
</div>
10 users included <br>
2 GB if storage <br>
Email support <br>
Help center <br>
</p>
<div class="d-flex btn btn-outline-primary justify-content-
center">Button</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title">Pro</h5>
</div>
<div class="card-body">
<div class="d-flex flex-row justify-content-center">
<h1 class=" d-flex font-weight-bold">$15</h1><h3 class="font-weight-light">/
mo</h3>
</div>
<p class="card-text">
15 users included <br>
10 GB if storage <br>
Priority Email support <br>
Help center <br>
</p>
<div class="d-flex btn btn-outline-primary justify-content-
center">Button</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title">Enterprise</h5>
</div>
<div class="card-body">
<div class="d-flex flex-row justify-content-center">
<h1 class=" d-flex font-weight-bold">$29</h1><h3 class="font-weight-light">/
mo</h3>
</div>
<p class="card-text">
30 users included <br>
15 GB of storage <br>
Phone and Email support <br>
Help center access <br>
</p>
<div class="d-flex btn btn-outline-primary justify-content-
center">Button</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
OUTPUT:
School of Information Technology
and Engineering
BITE304P
Web Technologies Laboratory
Assessment-2
JavaScript-JQuery-AngularJS-JSON-
AJAX- Exercises
1. A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges
an additional $0.50 per hour for each hour or part thereof above three hours. The maximum charge for
any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time.
Write a script that calculates and displays the parking charges for each customer who parked a car in
this garage yesterday. You should input from the user the hours parked for each customer. The
program should display the charge for the current customer and should calculate and display the
running total of yesterday's receipts. The program should use the function calculateCharges to
determine the charge for each customer. Use a prompt dialog to obtain input from the user.
CODE
<<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question 1</title>
</head>
<body>
<script>
function calculateCharges(hours) {
if (hours <= 3) {
return 2.00;
} else if (hours <= 24) {
const cost = 2.00 + (hours - 3) * 0.50;
if(cost <= 10){
return cost;
}
else
return 10.00 ;
} else {
return 10.00;
}
}
let totalReceipts = 0;
let hours = prompt("Enter hours parked (or 'done' to finish):");
hours = parseFloat(hours);
if (isNaN(hours) || hours < 0) {
alert("Invalid input!");
}
let charge = calculateCharges(hours);
totalReceipts += charge;
alert(`Charge for ${hours} hours: $${charge.toFixed(2)}`);
alert(`Total receipts: $${totalReceipts.toFixed(2)}`);
document.write(`<h1>The total for the user was
${totalReceipts}$</h1>`)
</script>
</body>
</html>
OUTPUT
2. Create a web page containing three divisions.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question 2</title>
<link
href="https://fonts.googleapis.com/css?family=Poppins:100,100italic,200,200ita
lic,300,300italic,regular,italic,500,500italic,600,600italic,700,700italic,800
,800italic,900,900italic" rel="stylesheet" />
<style>
* {
font-family: Poppins;
margin: 0;
padding: 0;
}
#clock {
width: 100%;
/* height: 30%; */
font-size: 50px;
font-weight: bold;
text-align: center;
/* margin: 50px auto; */
padding-top: 6%;
background-color: bisque;
}
.second {
position: relative;
}
#image {
position: absolute;
top: 21%;
left: 0;
background-color: #aaa;
width: 50%;
}
#color {
position: absolute;
top: 26%;
left: 50%;
width: 50%;
background-color: #aca;
height: 60vh;
padding: 2% 4%;
}
label {
display: inline-block;
margin-bottom: 10px;
}
input[type="color"] {
border: none;
height: 30px;
width: 30px;
padding: 0;
vertical-align: middle;
}
.slider {
width: 259px;
margin: 50px auto;
}
.slides {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
}
img {
scroll-snap-align: start;
width: 100%;
height: auto;
}
.controls {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
button {
background: none;
border: none;
font-size: 24px;
cursor: pointer;
}
button:focus {
outline: none;
}
.prev {
transform: rotate(180deg);
}
</style>
</head>
<body>
<div class="digital_clock" id="clock"></div>
<div class="second">
<div class="slides">
<img src="1.png" alt="Slide 1">
<img src="2.png" alt="Slide 2">
<img src="3.png" alt="Slide 3">
<img src="4.png" alt="Slide 4">
</div>
<div class="controls">
<button class="prev"><</button>
<button class="next">></button>
</div>
</div>
</div>
</div>
setInterval(updateClock, 1000);
//Color Picker
const colorPicker = document.getElementById("colorPicker");
});
//Image Slider
const slides = document.querySelector(".slides");
const prevButton = document.querySelector(".prev");
const nextButton = document.querySelector(".next");
let currentSlide = 0;
function showSlide(n) {
const slideWidth = slides.clientWidth;
const maxSlides = slides.children.length;
currentSlide = (n + maxSlides) % maxSlides;
slides.scrollTo({
left: currentSlide * slideWidth,
behavior: "smooth"
});
}
prevButton.addEventListener("click", () => {
showSlide(currentSlide - 1);
});
nextButton.addEventListener("click", () => {
showSlide(currentSlide + 1);
});
showSlide(currentSlide);
</script>
</body>
</html>
OUTPUT:
3. Write the JavaScript code to add behavior to the following page for manipulating strings. a) The
page UI allows the user to type a phrase into a text box. The user can click the "Go!" button to display
the words in that phrase in reverse order. Each word in the phrase should be inserted as a span with a
class of word, inside a div with the id of words. Every other word (the first, third, fifth, etc.) should
also be underlined b) The user can optionally specify a "filter" text by typing into a text box with the
id of the filter. If a non-blank filter is specified, you should exclude any words from the phrase that
contains that filter text, case-insensitively. For example, if the filter text is "abc", exclude any words
containing abc, ABC, aBc, etc. c) If any words are excluded, under the list of words you should
modify the div with an id of count to display the text of the form, "5 word(s) filtered out". The code
should work for multiple clicks of the button. On each click, it should clear any previous information
you injected. You may assume that words in the phrase are separated by single spaces. d) These
screenshots show the initial state, and after phrases have been typed and "Go!" is clicked.
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question 3</title>
<style>
.phrase,
.filter,
.but {
padding: 4px 10px;
}
#phrase {
width: 10%;
}
#filter {
width: 7%;
}
#words {
margin-top: 15px;
}
.word {
color: red;
border: 2px dotted red;
margin: 0 5px;
margin-top: 15px;
font-size: 23px;
padding: 5px 7px;
}
.string {
margin-top: 15px;
}
</style>
</head>
<body>
<h1>Sentence Reverser!</h1>
<div class="phrase">
<label for="phrase">Phrase:</label>
<input type="text" id="phrase">
</div>
<div class="filter">
<label for="filter">Filter: </label>
<input type="text" id="filter">
</div>
<div class="but"><button>Go</button></div>
<div id="words"></div>
<div class="string"></div>
</body>
<script>
const phraseInput = document.querySelector('#phrase');
const filterInput = document.querySelector('#filter');
const wordDiv = document.querySelector('#words');
const strings = document.querySelector('.string');
const goButton = document.querySelector('.but');
const span = document.createElement("span");
wordDiv.innerHTML += `<span
class='word'><u>${wordsArray[i]}</u></span>`;
} else {
wordDiv.innerHTML += `<span
class='word'>${wordsArray[i]}</span>`;
}
}
goButton.addEventListener('click', sentenceReverse);
</script>
</html>
OUTPUT:
4. Design a student registration form that takes the student's name, register number, DOB, program,
email id, temporary address, permanent address, and phone number. Validate the following using
JavaScript/JQuery:
a) The mobile number should be exactly 10 digits.
b) Register numbers should have alphabets and numbers only.
c) The name should not exceed 30 characters and can be only alphabets.
d) Email validation.
e) Provide a checkbox saying “Permanent address is same as temporary address”. If checked, the
value of the permanent address should be added automatically from the temp address. And should be
in disabled mode.
CODE:
<!DOCTYPE html>
<html>
<head>
<title>Student Registration Form</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('#permanent_address').prop('disabled', true);
$('#same_as_temp').change(function() {
if (this.checked) {
$('#permanent_address').val($('#temp_address').val());
$('#permanent_address').prop('disabled', true);
} else {
$('#permanent_address').prop('disabled', false);
$('#permanent_address').val('');
}
});
$('#register_form').submit(function(e) {
e.preventDefault();
var valid = true;
var name = $('#name').val();
var reg_num = $('#reg_num').val();
var dob = $('#dob').val();
var program = $('#program').val();
var email = $('#email').val();
var temp_address = $('#temp_address').val();
var permanent_address = $('#permanent_address').val();
var phone = $('#phone').val();
if (!/^[a-zA-Z ]{1,30}$/.test(name)) {
alert("Please enter a valid name.");
valid = false;
}
if (!/^[a-zA-Z0-9]+$/.test(reg_num)) {
alert("Please enter a valid register number.");
valid = false;
}
if (!/^\d{10}$/.test(phone)) {
alert("Please enter a valid 10-digit phone number.");
valid = false;
}
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
alert("Please enter a valid email address.");
valid = false;
}
if ($('#same_as_temp').is(':not(:checked)') &&
permanent_address === '') {
alert("Please enter a valid permanent address.");
valid = false;
}
if (valid) {
alert("Registration successful!");
// You can submit the form here.
}
});
});
</script>
</head>
<body>
<form id="register_form">
<label for="name">Name:</label>
<input type="text" id="name" name="name" maxlength="30" required>
<br><br>
<label for="reg_num">Register Number:</label>
<input type="text" id="reg_num" name="reg_num" required>
<br><br>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob" required>
<br><br>
<label for="program">Program:</label>
<input type="text" id="program" name="program" required>
<br><br>
<label for="email">Email ID:</label>
<input type="email" id="email" name="email" required>
<br><br>
<label for="temp_address">Temporary Address:</label>
<textarea id="temp_address" name="temp_address" required></textarea>
<br><br>
<label for="permanent_address">Permanent Address:</label>
<textarea id="permanent_address" name="permanent_address"></textarea>
<br><br>
<input type="checkbox" id="same_as_temp" name="same_as_temp">Permanent
address is same as temporary address.
<br><br>
OUTPUT:
5. Write the JQuery code to add behavior to the following page for keeping track of a todo list.
a) The page UI allows the user to type an item into a text box. The user can click the "add" button
to add the item to the bottom of the list. Each word in the phrase should be inserted as a li, inside an
ulwith the id of the list.
b) If the user wishes to remove an item he or she can type the text of the item he or she wishes to
remove in the text box and click the “remove” button. This should be caseinsensitive. For example, if
the list only contains “foo” and the user tries to remove “FoO”, it should be removed. If the user tries
to remove an item that is in the list multiple times only the first occurrence should be removed.
c) The items should have background colors that alternate between white and yellow (first white, then
yellow, then white, yellow, etc.). This should still be the case no matter how many items are removed
or added and no matter what order these operations are done in.
d) The code should work for multiple clicks of the buttons. On each click, it should clear any
previous information you typed in the input boxes. These screenshots show the state after items have
been added and the state after items have been removed.
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question 5</title>
<style>
.yel {
background-color: yellow;
}
</style>
</head>
<body>
<h1>My to do list</h1>
<ul></ul>
list(items[i], i);
} else {
colist(items[i], i);
}
}
// $("ul li:nth-child(2)").css("background-color", "yellow");
}
var i = 0;
var addBtn = $('#add');
addBtn.click(function() {
var inputVal = $("input").val();
$('input').val("");
items.push(inputVal);
// list(items[i], i);
// i++;
color();
})
var remBtn = $('#remove');
remBtn.click(function() {
// i -= 1;
var inputVal = $("input").val();
var newItems = [];
for (y in items) {
if (inputVal.toLowerCase() != items[y].toLowerCase()) {
newItems.push(items[y]);
}
}
items = newItems;
// var x = 0;
// if (inputVal.toLowerCase() == items[y].toLowerCase()) {
// var items = items.filter(function(inputVal) {
// return inputVal.toLowerCase() !=
items[y].toLowerCase();
// })
$('input').val("");
color();
})
})
</script>
</html>
OUTPUT:
6. Develop a JSON program for creating 20 students' personal information using the following fields
as input and print the outputs in table format (Use any Javascript/JQuery/AngularJS). student name,
date_of_birth(date,month,year),parents(fathers_name,mothers_name),
blood_group,email,phone(landline,mobile),address(door_no,street_name,place_name, pincode,
country),degree(ug,pg and others).
CODE:
OUTPUT:
8. Develop a web application using AngularJS and add behavior to the following HTML code. The
page contains a text input box with an id of foodname, and a drop-down list with an id of foodgroup.
i. The user types a name of a food item into the foodname text box, such as apple or Cookie, selects a
food group from the drop-down list, such as dairy or fruit, and then clicks the button with an id of eat.
ii. When the eat button is clicked, any element on the page that matches all of the following criteria
will be removed from the page: a. The element is an img element that has a class of food. b. The
element's food group matches the group chosen in the foodgroup drop-down list. Food groups are
represented as class attributes. This is in addition to the food class; recall that class attributes can
specify multiple classes separated by spaces. For example, a jug of milk would have the following
element:
c. The food item's name is the same as the text in the foodname box. The food's name is stored as the
image's alt attribute. For example, if the user types cookie, img elements with an alt of cookie will be
removed. Your code should be case-insensitive; for example, coOKIe should match images with an
alt of cookie.
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></s
cript>
</head>
<body>
<div ng-app="myApp" ng-controller="jsCtrl1">
Name of Food: <input id="foodname" type="text" ng-model="foodname" />
Food Group:
<select id="foodgroup" ng-model="foodgroup">
<option>dairy</option>
<option>fats</option>
<option>fruit</option>
<option>meat</option>
<option>veggies</option>
</select>
<button id="eat" ng-click="remove()">Eat!</button>
<div ng-switch="foodgroup">
<div ng-switch-when="dairy">
<img src="milk.png" class="food dairy" alt="milk" ng-
hide="milk" ng-model="milk" />
</div>
<div ng-switch-when="fats">
<img src="cookies.png" class="food fats" alt="cookie" ng-
hide="cookie" ng-model="cookie" />
<img src="chips.png" class="fats food other" alt="chips" ng-
hide="chips" ng-model="chips" />
</div>
<div ng-switch-when="fruit">
<img src="apple.png" class="fruit yummy food" alt="apple" ng-
hide="apple" ng-model="apple" />
<img src="tamato.png" class="fruit food" alt="tomato" ng-
hide="tomato" ng-model="tomato" />
</div>
<div ng-switch-when="meat">
<img src="steak.png" class="food meat" alt="steak" ng-
hide="steak" ng-model="steak" />
</div>
<div ng-switch-when="veggies">
<img src="broc.png" class="food veggies" alt="broccoli" ng-
hide="broccoli" ng-model="broccoli" />
</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('jsCtrl1', function($scope) {
switch ($scope.foodname) {
case 'cookie':
$scope.cookie = "true";
$scope.foodname = "";
break;
case 'apple':
$scope.apple = "true";
$scope.foodname = "";
break;
case 'tomato':
$scope.tomato = "true";
$scope.foodname = "";
break;
case 'milk':
$scope.milk = "true";
$scope.foodname = "";
break;
case 'chips':
$scope.chips = "true";
$scope.foodname = "";
break;
case 'steak':
$scope.steak = "true";
$scope.foodname = "";
break;
}
}
});
</script>
</body>
</html>
OUTPUT:
9. For the given form layout below, use the AngularJS code to perform form validation using a regular
expression on the following fields : i. All elements marked * are required elements that should be
validated. ii. The Name should contain alphabets iii. Validate Email element iv. The Zipcode should
be a length of 6 digits and the Phone of length 10 digits v. The password should be in the range of 6-8
characters and the Password and Verify password should match. Display the possible validation error
messages.
CODE:
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></s
cript>
<style>
.red {
color: red;
}
table {
border: 2px solid black;
border-collapse: collapse;
}
th,
td {
padding: 15px 15px;
}
</style>
<body>
<!-- <form ng-app="myApp" ng-controller="validateCtrl" name="myForm"
novalidate>
<p>Username:<br><input type="text" name="user" ng-model="user"
required>
<span style="color:red" ng-show="myForm.user.$dirty &&
myForm.user.$invalid">
<span ng-show="myForm.user.$error.required">Username is
required.</span></span>
</p>
<p>Email:<br><input type="email" name="email" ng-model="email"
required>
<span style="color:red" ng-show="myForm.email.$dirty &&
myForm.email.$invalid">
<span ng-show="myForm.email.$error.required">Email is required.</span>
<span ng-show="myForm.email.$error.email">Invalid email
address.</span></span>
</p>
<p>
<input type="submit“ ng-disabled=" myForm.user.$dirty &&
myForm.user.$invalid || myForm.email.$dirty && myForm.email.$invalid
"></p></form> -->
<h1>Account Opening Form</h1>
<form ng-app="myApp" ng-controller="validateCtrl" name="myForm"
novalidate>
<table>
<tr>
<th colspan="2">Personal Details</th>
</tr>
<tr>
<td>
<label for="name">Name*</label>
</td>
<td>
<input type="text" name="name" ng-model="name" ng-
pattern="/^[a-zA-Z]+$/" required><br>
<span ng-show="myForm.name.$error.pattern" class="red">
Only alphabets are allowed.
</span>
</td>
</tr>
<tr>
<td>
<label for="nameOf">Name of
<br><i>(Father/Guardian)</i></label>
</td>
<td>
<input type="text" name="nameOf" ng-model="nameOf">
</td>
</tr>
<tr>
<td><label for="dob">Date of Birth*(dd-mm-yy)</label></td>
<td>
<input type="date" name="dob" id="dob" ng-model="dob" ng-
pattern="/^(0[1-9]|{12}[0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}$/">
</tr>
<tr>
<td><label for="gender">Gender*</label></td>
<td>
<input type="radio" name="gender" id="male" ng-
model="gender" value="male" ng-required="true">
<label for="male">Male</label>
<input type="radio" name="gender" id="female" ng-
model="gender" value="female" ng-required="true">
<label for="female">Female</label>
</td>
<div ng-show="myForm.$submitted || myForm.gender.$touched">
<div ng-show="myForm.gender.$error.required">Please select
a gender.</div>
</div>
</tr>
<tr>
<td>
<label for="nation">Nationality</label>
</td>
<td><input type="text" id="nation" ng-model="nation"></td>
</tr>
<tr>
<td><label for="gender">Account Type*</label></td>
<td>
<input type="radio" name="acc" id="savings" ng-model="acc"
value="savings" ng-required="true">
<label for="savings">Savings</label>
<input type="radio" name="acc" id="fixed" ng-model="acc"
value="fixed" ng-required="true">
<label for="fixed">Fixed</label>
</td>
<div ng-show="myForm.$submitted || myForm.gender.$touched">
<div ng-show="myForm.gender.$error.required">Please select
a gender.</div>
</div>
</tr>
<tr>
<td>
Preferences
</td>
<td>
<label><input type="checkbox" name="preference"
value="internet_banking"> Internet Banking</label>
<label><input type="checkbox" name="preference"
value="mobile_banking"> Mobile Banking</label>
<label><input type="checkbox" name="preference"
value="sms_alerts"> SMS Alerts</label> </td>
</tr>
<tr>
<td>
<label for="address">Address</label>
</td>
<td>
<textarea id="address" name="address" rows="4" cols="50"
ng-model="address"></textarea>
</td>
</tr>
<tr>
<td><label for="country">Country*</label></td>
<td><select id="country" name="country" required ng-
model="country">
<label for="zipcode">Zipcode*</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="email">Email*</label>
</td>
<td>
</tr>
<tr>
<td>
<label for="password">Password*</label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<div ng-show="myForm.verifyPassword.$error.required"
class="red">Verify Password is required.</div>
<div ng-show="myForm.verifyPassword.$error.minlength"
class="red">Verify Password should be at least 6 characters long.</div>
<div ng-show="myForm.verifyPassword.$error.maxlength"
class="red">Verify Password should be at most 8 characters long.</div>
<div ng-show="myForm.verifyPassword.$error.pattern"
class="red">Passwords do not match.</div>
</td>
</tr>
</table>
</form>
<script>
var app = angular.module('myApp', []);
app.controller('validateCtrl', function($scope) {
// $scope.user = 'John Doe';
// $scope.email = '[email protected]';
});
</script>
</body>
</html>
OUTPUT:
1—
HTML:
<!DOCTYPE html>
<html>
<head>
<title>BMI Calculator</title>
</head>
<body>
<h1>BMI Calculator</h1>
<form id="bmi-form">
<label for="name">Name:</label>
<label for="email">Email:</label>
</form>
<h2 id="output"></h2>
<script src="script.js"></script>
</body>
</html>
JAVASCRIPT::
document.getElementById('bmi-form').addEventListener('submit', function(event) {
if (!validateName(name)) {
return;
if (!validateEmail(email)) {
return;
if (!validateDate(dob)) {
return;
alert('Invalid weight');
return;
alert('Invalid height');
return;
age--;
const output = `
Name: ${name.toUpperCase()}
Age: ${age}
Weight: ${weight} kg
BMI: ${bmi.toFixed(2)}
`;
document.getElementById('output').textContent = output;
});
function validateName(name) {
return nameRegex.test(name);
function validateEmail(email) {
return emailRegex.test(email);
}
function validateDate(dateString) {
return !isNaN(date.getTime());
2—
HTML:
<!DOCTYPE html>
<html>
<head>
<style>
form {
width: 400px;
margin: 0 auto;
padding: 20px;
border-radius: 5px;
input {
display: block;
width: 100%;
margin-bottom: 10px;
padding: 5px;
border-radius: 3px;
}
button {
display: block;
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
#output {
color: red;
background-color: yellow;
font-size: 20px;
text-align: center;
padding: 10px;
</style>
</head>
<body>
<form id="fd-form">
<label for="name">Name:</label>
<button type="submit">Calculate</button>
</form>
<h1 id="output"></h1>
<script src="script.js"></script>
</body>
</html>
JAVASCRIPT:
document.getElementById('fd-form').addEventListener('submit', function(event) {
if (!validateName(name)) {
return;
return;
return;
const output = `
Name: ${name.toUpperCase()}
`;
document.getElementById('output').textContent = output;
});
function validateName(name) {
return nameRegex.test(name);
function getInterestRate(days) {
return 5.75;
return 5.85;
return 6.30;
return 6.70;
return 7.25;
} else {
return 0;
}
3—
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h1>Registration Form</h1>
<form id="registration-form">
<div class="form-group">
<label for="name">Name:</label>
</div>
<div class="form-group">
<label for="email">Email:</label>
</div>
<div class="form-group">
<label for="password">Password:</label>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="gender">Gender:</label>
</div>
<div class="form-group">
<label for="language">Language:</label>
<option value="english">English</option>
<option value="french">French</option>
<option value="spanish">Spanish</option>
</select>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="about">About:</label>
</div>
<button type="submit">Register</button>
</form>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Gender</th>
<th>Language</th>
<th>Zip Code</th>
<th>About</th>
</tr>
<tr id="output-row"></tr>
</table>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>
JAVASCRIPT:
$(document).ready(function() {
$('#registration-form').submit(function(event) {
event.preventDefault();
if (!validateName(name)) {
return;
if (!validateEmail(email)) {
alert('Invalid email format');
return;
if (!validatePhone(phone)) {
return;
if (!validateZipcode(zipcode)) {
return;
if (!gender) {
return;
$('#output-row').html(`
<td>${name}</td>
<td>${email}</td>
<td>${phone}</td>
<td>${gender}</td>
<td>${language}</td>
<td>${zipcode}</td>
<td>${about}</td>
`);
$('#output-table').show();
});
function validateName(name) {
function validateEmail(email) {
return emailRegex.test(email);
function validatePhone(phone) {
return phoneRegex.test(phone);
function validateZipcode(zipcode) {
return zipcodeRegex.test(zipcode);
});
4—
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
</head>
<body>
<form>
<div class="form-group">
<label for="name">Name:</label>
</div>
<div class="form-group">
<label for="email">Email:</label>
</div>
<div class="form-group">
<label for="phone">Phone:</label>
</div>
</form>
<div class="card">
</div>
</div>
</div>
<div class="card">
<div class="card-body">
</div>
</div>
</div>
<div class="card">
<div class="card-body">
</div>
</div>
</div>
<div class="card">
<div class="card-body">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
CSS:
.menu-item-title {
color: red;
background-color: yellow;
padding: 5px;
.card {
height: 100%;
.card-img-top {
height: 200px;
object-fit: cover;
}
5—
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
</head>
<body>
<h1>Login Form</h1>
<form id="login-form">
<label for="username">Username:</label>
<br>
<label for="password">Password:</label>
<br>
<button type="submit">Enter</button>
</form>
<script src="script.js"></script>
</body>
</html>
JAVASCRIPT:
// Create an associative array named as login which is populated with username as key and
password as value
const login = {
"user1234": "pass1234",
"user5678": "pass5678",
"user9012": "pass9012"
};
if (!(username in login)) {
document.getElementById("login-form").addEventListener("submit", function(event) {
document.getElementById("output").textContent = output;
});