Professional Documents
Culture Documents
RECORD OF PRACTICALS
NAME : ……………………………….….
REGISTER NUMBER: ……………………………………..
SEMESTER : …………………………………..
YEAR : …………………………………..
SUBJECT : …………………………………..
INDIRA GANDHI COLLEGE OF ARTS AND SCIENCE
(AFFILIATED TO PONDICHERRY UNIVERSITY)
PUDUCHERRY-605 009
( ACCREDITED WITH B+, NAAC)
BONAFIDE CERTIFICATE
Certified that this is a bonafide record of practical work done by
Selvan / Selvi…………………………………………………………with
register number ……………………… of ………………… during the
………….. semester of the year …………………………
Internal Examiner
TABLE OF CONTENT
PAGE
S.No DATE CONTENT SIGNATURE
No
PAGE
S.No DATE CONTENT SIGNATURE
No
Module:9
Coding examples with JavaScript
Create Page Elements with JavaScript
Interactive List with JavaScript
Create List of Elements
JavaScript Closures data
Image Gallery with JavaScript
Module:10
Simple website from starch
Tools and Resources
Simple Website CSS
Three Column Website
Three Column Website Flexbox
Three Column Website CSS Grid
HTML form CSS Grid
Website Review and Conclusion
Module:11
Fat footer website flex
Website Fat Footer Design
Setup of HTML Code
Web Site Wire Frame
Add Page HTML from Wireframe
Setup CSS for Page
Header and Footer Style
Logo and Nav in Header
Footer Styling CSS
Social Icons Font Awesome
Footer Bottom Copyright Plu
Website Fat Footer with Flex Conclusion
Module:12
CSS grid website with flex navbar
Website Planning and Wireframe
Create Page HTML Structure
Add CSS Grid
Responsive navbar
Apply Styling CSS Fun
Header Footer CSS
Add Color and Font Style
Module:13
Single page website sticky bottom navbar
HTML Setup for Web Page
HTML Page Structure
CSS Page Header
CSS Home Section
Sections Styling CSS
Create web Form
Set Page Footer
Make Responsive CSS
Module:14
Web design and web development resources and helpful tips and
lessons
Github and Git Pages Getting started with GitHub and git
Module:1
What is HTML?
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
HTML elements label pieces of content such as "this is a
heading", "this is a paragraph", "this is a link", etc.
Module:2
What is an HTML Element?
An HTML element is defined by a start tag, some content, and an
end tag:
<tag name> Content goes here... </tag name>
The HTML element is everything from the start tag to the end tag:
<h1>My First Heading</h1>
<p>My first paragraph</p>
HTML elements can be nested (this means that elements can contain
other elements).
All HTML documents consist of nested HTML elements.
The following example contains four HTML elements (<html>,
<body>, <h1> and <p>):
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph. </p>
</body>
</html>
HTML tags are not case sensitive: <P> means the same as <p>.
The HTML standard does not require lowercase tags, but W3C
recommends lowercase in HTML, and demands lowercase for stricter
document types like XHTML.
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least
important heading.
Example
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
The HTML <ins> element defines a text that has been inserted into a
document. Browsers will usually underline inserted text:
Example
<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>
HTML Lists
HTML lists allow web developers to group a set of related items in
lists.
HTML Tables
HTML tables allow web developers to arrange data into rows and
columns.
Fruit name Quantity Amount
Apple 1kg $3.01
Banana 1kg $1.80
Strawberry 1kg $6.01
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
Table Cells
Each table cell is defined by a <td> and a </td> tag.
td stands for table data.
Everything between <td> and </td> are the content of the table
cell.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
Inline Elements
An inline element does not start on a new line.
An inline element only takes up as much width as necessary.
HTML Forms
An HTML form is used to collect user input. The user input is most
often sent to a server for processing.
The <form> Element
The HTML <form> element is used to create an HTML form for user
input:
<form>
.form elements
.form element
</form>
The <form> element is a container for different types of input
elements, such as: text fields, checkboxes, radio buttons, submit
buttons, etc.
The <input> Element
The HTML <input> element is the most used form element.
An <input> element can be displayed in many ways, depending on the
type attribute.
Examples:
Type Description
<input type="text"> Displays a single-line text input field
<input type="radio"> Displays a radio button (for selecting one of
many choices)
<input type="checkbox"> Displays a checkbox (for selecting zero or
more of many choices)
<input type="submit"> Displays a submit button (for submitting
the form)
<input type="button"> Displays a clickable button
Text Fields
The <input type="text"> defines a single-line input field for text
input.
Example
A form with input fields for text:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
OUTPUT:
First name:
Last name:
Radio Buttons
The <input type="radio"> defines a radio button.
Radio buttons let a user select ONE of a limited number of choices.
Example
A form with radio buttons:
<p>Choose your favorite Web language:</p>
<form>
<input type="radio" id="html" name="fav_language"
value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language"
value="JavaScript">
<label for="javascript">JavaScript</label>
</form>
OUTPUT:
Choose your favorite Web language:
o HTML
o CSS
o JavaScript
Checkboxes
The <input type="checkbox"> defines a checkbox.
Checkboxes let a user select ZERO or MORE options of a limited
number of choices.
Example
A form with checkboxes:
<form>
<input type="checkbox" id="vehicle1" name="vehicle1"
value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2"
value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3"
value="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
OUTPUT:
I have a bike
I have a car
I have a boat
<html>
<head>
<title>Basic Tag</title>
</head>
<body>
<font face="Prepetua Titling MT" color="#ff0c7c">
<h1 align="center">Slogans</h1>
</font><br>
<h2>Master Card</h2>
<p>
<font face="Segoe UI Light" Size="4">
'There are some things <b>money can't buy</b> For everything
else, there's <b><i>Master Card</i></b>'
</font>
</p>
<h2>Apple</h2>
<p>
<font face="Segoe UI Light" Size="4">
'<i>Think Different</i>'
</font>
</p>
<h2>Audi</h2>
<p>
<font face="Segoe UI Light" Size="4">
'Advancement Through <strong> Technology</strong>'
</font>
</p><hr><br>
WATER = H<sub>2</sub>O <br>
(a+b)<sup>2</sup> = a<sup>2</sup> + 2ab + b<sup>2</sup>
<br><br><hr>
<address>
No: 32, New St, <br>Anna Nagar <br> Chennai-600040
</address>
</body>
</html
OUTPUT:
<html>
<head>
<title>List</title>
</head>
<body>
<h1>Diary Group</h1>
<ol type="I">
<li>Milk</li>
<li>Yogurt</li>
<li>Cheese</li>
<li>Butter</li>
<li>Cream</li>
</ol>
<h1>Beverages</h1>
<ul type="circle">
<li>Tea</li>
<li>Coffee</li>
<li>Cola</li>
</ul>
<dl>
<dt>Tea</dt>
<dd>"A Cup of Tea is a Cup of Peace"</dd>
<dt>Coffee</dt>
<dd>"The Gasoline of Life"</dd>
</dl>
</body>
</html>
OUTPUT:
<html>
<head>
<title>Student_Strength</title>
</head>
<body bgcolor="#d7fbf1">
<br><br>
<table border="2px" bordercolor="grey">
<thead>
<tr>
<td colspan="6" style="text-align: center">
STUDENT TOTAL STRENGTH
</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
This Table will show the Details About the Total Strength of the
Students in this College
</td>
</tr>
</tfoot>
<tbody>
<tr>
<th width="80">Year</th>
<th>BAM</th>
<th>BBT</th>
<th>BCA</th>
<th>BFT</th>
<th>BST</th>
</tr>
<tr>
<th>I Year</th>
<td>60</td>
<td>60</td>
<td>60</td>
<td>120</td>
<td>60</td>
</tr>
<tr>
<th>II Year</th>
<td>60</td>
<td>60</td>
<td>60</td>
<td>120</td>
<td>60</td>
</tr>
<tr>
<th>III Year</th>
<td>60</td>
<td>60</td>
<td>60</td>
<td>120</td>
<td>60</td>
</tr>
<tr>
<th>TOTAL</th>
<td>180</td>
<td>180</td>
<td>180</td>
<td>360</td>
<td>180</td>
</tr>
</tbody>
</table>
</body>
</html>
OUTPUT:
EX:4 FORMS IN HTML
<html>
<head>
<title>Form1</title>
</head>
<body bgcolor="pink">
<h3 align="center">
Application Form <br>
(For International Conferrence)
</h3>
<br>
<form>
<b>First Name</b> : <input type="text" name="fname" /> <br><br>
<b>Last Name</b> : <input type="text" name="lname" />
<br /><br>
<b>Gender</b> :
<input type="radio" name="Gender" value="male" />Male
<input type="radio" name="Gender" value="female" />Female
<br /><br>
<b>Mobile No</b> : <input type="text"><br><br>
<b>Year</b> : <select name="dropdown">
<option value="Select">--select--</option>
<option value="year1">I YEAR</option>
<option value="year2">II YEAR</option>
<option value="year3">III YEAR</option>
</select>
<br><br>
<b>Topic</b> : <br><br>
<textarea name="topic" cols="30" rows="3"></textarea>
<br><br>
<b>Timming</b> : (Choose your convinent Timimng) <br><br>
<input type="checkbox"> 10:00 To 11:30 AM
<input type="checkbox"> 11:30 To 12:00 AM <br><br>
<input type="checkbox"> 12:00 To 01:30 PM
<input type="checkbox"> 01:30 To 03:00 PM
<br><br><br>
<b>Payment Mode</b> : <br><br>
<p style="margin-left: 20px;">
<input type="radio" name="payment" value="card">
Debit/Credit Card <br><br>
<p style="margin-left: 50px;">
Card No :
<input type="text" name="card_no" maxlength="16" size="16" />
<br><br>
CCV No :
<input type="text" name="ccv_no" maxlength="3" size="3" />
<br><br>
PIN :
<input type="password" name="pin" maxlength="4" size="4" />
<br><br>
</p>
</p>
<p style="margin-left: 80px;">
(OR) <br><br>
</p>
<p style="margin-left: 20px;">
<input type="radio" name="payment" value="acc_transfer"/>
Online Bank Transaction <br><br>
<p style="margin-left: 50px;">
Account No:
<input type="text" name="acc_no" maxlength="16" size="16" />
<br><br>
User ID : <input type="text" name="user_id" /> <br><br>
Password :
<input type="password" name="password" maxlength="8" size="8" >
<br><br></p>
</p>
Upload Photo :
<input type="file" name="photo" accept = "images/*"><br><br>
<b>Lunch</b> : <input type="radio" name="lunch"
value="veg"/>Veg
<input type="radio" name="lunch" value="non_veg"/>Non-Veg
<br><br>
<button>Submit</button>
</form>
</body>
</html>
OUTPUT:
EX:5 CREATING WEBSITE USING HTML TAGS
MAIN PAGE:
<html>
<head>
<title>document</title>
<link rel="stylesheet" href="myclass.css">
</head>
<body background="ice.png"/>
<header>
<center><b> <h1>HEAVEN</h1></b>
<i><h2>Melts on your mouth</i>
<p>No:7,white town,pondicherry-605110</p><h2></center>
</header>
<section>
<a href="aboutus.html">
<h1>ABOUT US</h1></a><br>
<a href="main.html">
<h1>OUR LOVES</h1></a><br>
<a href="form.html">
<h1>CUSTOMIZE YOUR<BR> OWN ICE CREAM</h1></a>
</section>
<footer>
<i>contact us Ph:0987654321,Mail:heavenicecream@gmail.com</i>
</footer>
</body>
</html>
ABOUT US
<html>
<head>
<title>about us</title>
</head>
<body style="background-color:lavender">
<center><img src="heaven.jpg" width="50%"
height="50%"></center>
<center><p><h1>we have both chocolates and ice creams</h1></p>
<p><h1>you can customize your ice creams</h1></p>
<p><h2>FLAVOURS</h2></p>
<ul>
<h3><li>vannila
<li>starwberry
<li>chocolate
<li>butterscoch
<li>blueberry
<li>fruit and nut</center><h3>
</ul>
</body>
</html>
FORM:
<html>
<head>
<title>form</title>
</head>
<body style="background-color:lavender">
<script type="text/javascript">
<form>
FIRST NAME:<input name="text"><br><br>
SECOND NAME:<input name="text"><br><br>
MOBILE NUMBER:<input name="text"><br><br>
ADDRESS:<input name="text"><br><br>
FLAVOURS:<br><input type="checkbox">chocolate<br>
<input type="checkbox">vannila<br>
<input type="checkbox">starwberry<br>
<input type="checkbox">butterscoch<br>
<input type="checkbox">blueberry<br>
<input type="checkbox">blackcurrent<br><br>
TOPINGS:<br><input type="checkbox">chocolate<br>
<input type="checkbox">kissbiss<br>
<input type="checkbox">starwberry<br>
<input type="checkbox">dry fruits<br>
<input type="checkbox">sugar balls<br>
<input type="checkbox">brownie<br><br>
QUANTITY:<br><input type="radio" name="qut">200gm<br>
<input type="radio" name="qut">300gm<br>
<input type="radio" name="qut">500gm<br>
<input type="radio" name="qut">600gm<br>
<input type="radio" name="qut">700gm<br>
<input type="radio" name="qut">1000gm<br><br>
PAYMENT :
<input type="radio" name="pay">By Cash<br>
<input type="radio" name="pay">Debit Card<br>
<input type="radio" name="pay">Cedit Card<br>
<input type="radio" name="pay">Online
Payment<br><br>
<input type="button" value="SUBMIT" >
</form>
</body>
</html>
DISCOUNT
<html>
<head>
<title>MAIN</title>
</head>
<body style="background-color: lavender">
<center> <H1>OUR LOVES</H1>
<marquee position="down">FEEL THE HEAVEN ON YOUR
TOUNGE</marquee>
<br>
<br>
<br>
<h2><p>WE GIVE QUALITY ICE CREAMS AT LOW
COST</P>
<p>SAMPLES HAS BEEN GIVEN</P>
<P>DISCOUNT ON PURCHASES ABOVE 500</P>
OUTPUT:
Module:3
What is CSS?
CSS stands for Cascading Style Sheets
CSS describes how HTML elements are to be displayed on
screen, paper, or in other media
CSS saves a lot of work. It can control the layout of multiple
web pages all at once
External stylesheets are stored in CSS files
CSS Syntax
CSS selector
The selector points to the HTML element you want to style.
The declaration block contains one or more declarations separated by
semicolons.
Each declaration includes a CSS property name and a value, separated
by a colon.
Multiple CSS declarations are separated with semicolons, and
declaration blocks are surrounded by curly braces.
Example
In this example all <p> elements will be center-aligned, with a red
text color:
p{
color: red;
text-align: center;}
CSS Comments
Comments are used to explain the code, and may help when you edit
the source code at a later date.
Comments are ignored by browsers.
A CSS comment is placed inside the <style> element, and starts
with /* and ends with */:
Example
/* This is a single-line comment */
p{
color: red;
}
You can add comments wherever you want in the code:
Example
p{
color: red; /* Set text color to red */
}
Even in the middle of a code line:
Example
p{
color: /*red*/blue;
}
Comments can also span multiple lines:
Example
/* This is
a multi-line
comment */
p{
color: red;
}
CSS selectors are used to "find" (or select) the HTML elements
you want to style.
We can divide CSS selectors into five categories:
Simple selectors (select elements based on name, id, class)
Combinator selectors (select elements based on a specific
relationship between them)
Pseudo-class selectors (select elements based on a certain state)
Pseudo-elements selectors (select and style a part of an element)
Attribute selectors (select elements based on an attribute or
attribute value)
CSS Fonts
Font Selection is Important
Choosing the right font has a huge impact on how the readers
experience a website.
The right font can create a strong identity for your brand.
Using a font that is easy to read is important. The font adds value to
your text. It is also important to choose the correct color and text size
for the font.
Generic Font Families
In CSS there are five generic font families:
Serif fonts have a small stroke at the edges of each letter. They
create a sense of formality and elegance.
Sans-serif fonts have clean lines (no small strokes attached).
They create a modern and minimalistic look.
Monospace fonts - here all the letters have the same fixed width.
They create a mechanical look.
Cursive fonts imitate human handwriting.
Fantasy fonts are decorative/playful fonts.
Some Font Examples
Generic Font Family Examples of Font Names
Serif Times New Roman
Georgia
Garamond
Sans-serif Arial
Verdana
Helvetica
Monospace
Lucida Console
Monaco
Cursive Brush Script MT
Lucida Handwriting
Fantasy
Example
Specify some different fonts for three paragraphs:
.p1 {
font-family: "Times New Roman", Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
Module:4
#grad {
background-image: radial-gradient(circle, red, yellow, green);
}
Module:5
Image Gallery
The following image gallery is created with CSS:
Example
<html>
<head>
<style>
div.gallery {
margin: 5px;
border: 1px solid #ccc;
float: left;
width: 180px;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
}
</style>
</head>
<body>
<div class="gallery">
<a target="_blank" href="img_5terre.jpg">
<img src="img_5terre.jpg" alt="Cinque Terre" width="600"
height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="gallery">
<a target="_blank" href="img_forest.jpg">
<img src="img_forest.jpg" alt="Forest" width="600"
height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="gallery">
<a target="_blank" href="img_lights.jpg">
<img src="img_lights.jpg" alt="Northern Lights" width="600"
height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="gallery">
<a target="_blank" href="img_mountains.jpg">
<img src="img_mountains.jpg" alt="Mountains" width="600"
height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</body>
</html>
Grid Layout
The CSS Grid Layout Module offers a grid-based layout system, with
rows and columns, making it easier to design web pages without
having to use floats and positioning.
Grid Elements
A grid layout consists of a parent element, with one or more child
elements.
Example
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
EX:6 CSS CASCADING STYLE SHEET
<html>
<head>
<title>Tribute</title>
<link rel="Stylesheet" href="mycss.css">
<style>
*{
font-family: Times New Roman
}
body {
background-color: #01bdec;
margin: 20%;
}
#image {
display: inline-block;
width: 100%;
}
</style>
</head>
<body>
<h1 id="title">
A. P. J. Abdul Kalam
</h1>
<div id="image">
<!--Image of the Tribute Person-->
<img src="abdul-kalam.png"
id="image" alt="Error Loading Image">
<small style="font-size: 19px; font-family: Gill Sans; color:rgb(73,
252,
162);">
Great Indian scientist and
politician who played a leading
role in the development of India’s
missile and nuclear weapons
programs.
</small>
</div>
<div class="tribute-data">
<h1 class="title-APJ">
About the Legend
</h1>
<p>
☛ A.P.J. Abdul Kalam, in full Avul Pakir Jainulabdeen Abdul Kalam,
was
born on October 15, 1931, in Rameswaram, Tamil Nadu,
India.<br><br>
☛ He served as the 11th President of India from 2002 to
2007.<br><br>
☛ Kalam earned a degree in aeronautical engineering from the
Madras
Institute of Technology and in 1958 joined the Defence Research and
Development Organisation (DRDO).<br><br>
☛ In 1969, he moved to the Indian Space Research Organisation,
where
he was project director of the SLV-III, the first satellite launch vehicle
that was
both designed and produced in India.<br><br>
☛ Rejoining DRDO in 1982, Kalam planned the program that
produced
a number of successful missiles, which helped earn him the nickname
<strong>
“Missile Man.” </strong> <br><br>
☛ Among those successes was Agni, India’s first intermediate-range
ballistic missile, which incorporated aspects of the SLV-III and was
launched in
1989. <br><br>
☛ He also played a pivotal organisational, technical, and political role
in
India's Pokhran-II nuclear tests in 1998, the first since the original
nuclear test
by India in 1974. <br><br>
☛ Kalam received <b>7</b> honorary doctorates from <b>40</b>
universities. The Government of India honoured him with the
<b>Padma
Bhushan in 1981</b> and the <b>Padma Vibhushan in 1990</b> for
his work
with ISRO and DRDO and his role as a scientific advisor to the
Government.<br><br>
☛ While delivering a lecture at the Indian Institute of Management
Shillong, Kalam collapsed and died from an apparent cardiac arrest on
<b>27
July 2015</b>, aged 83.<br><br>
☛ Wheeler Island, a national missile test site in Odisha, was renamed
<b>Kalam Island</b> in September 2015.<br><br>
☛ A prominent road in New Delhi was renamed from Aurangzeb
Road
to <b>Dr APJ Abdul Kalam Road</b> in August 2015. <br><br>
☛ In February 2018, scientists from the Botanical Survey of India
named a newly found plant species as Drypetes kalamii, in his
honour.
</p>
</div>
</body>
</html>
mycss.html
.title-APJ, #title {
text-align: center;
}
.tribute-data{
background-color: rgba(55, 242, 255, 0.418);
box-shadow: 20px 20px 20px #40f2ffb6;
font-family: Georgia;
padding: 25px 25px;
margin: 11px;
margin-top: 50px;
}
.title-APJ{
font-size: 35px;
color: white;
text-shadow: 5px 5px 10px black;
}
#title {
color:ivory;
text-shadow: 4px 4px 15px rgba(76, 75, 75, 0.856);
font-size: 40px;
}
OUTPUT:
EX:7 CSS USING LAYOUT
lay=swap');
*{
box-sizing: border-box;
}
body{
font-family: 'Rubik', sans-serif;
.wrapper
{
display: grid;
grid-gap: 5px;
grid-template-columns: 15% 35% 35% 15%;
grid-template-areas:
'header header header header'
'nav nav nav nav'
'side content content ads'
'footer footer footer footer';
}
.main-nav
{
grid-area: nav;
}
.main-nav ul{
display: flex;
list-style: none;
margin: 0;
padding: 0;
background: black;
color:white;
}
.main-nav
a{
display: block;
text-align: center;
font-size: 1.5em;
text-decoration: none;
color:white;
padding: 5px 10px;
}
.main-nav a:hover{
background: #ccc;
}
.main-head{
grid-area: header;
background: blue;
padding: 40px;
font-size: 3em;
text-align: center;}
.content{
grid-area: content;
}
.ads{
grid-area: ads;
background: purple;
min-height: 200px;
}
.side{
grid-area: side;
background: pink;
min-height: 200px;
text-align: center;
}
.main-footer {
grid-area: footer;
background: red;
padding: 40px;
font-size: 3em;
text-align: center;
}
@media (max-width: 600px){
.main-nav ul{
flex-direction: column;
}
.wrapper{
grid-template-columns: auto;
grid-template-areas:
'header'
'nav'
'content'
'side'
'ads'
'footer';
}
}
OUTPUT:
Module:5
Introduction to JavaScript
JavaScript Comments
JavaScript comments can be used to explain JavaScript code, and to
make it more readable.
JavaScript comments can also be used to prevent execution, when
testing alternative code.
Single Line Comments
Single line comments start with //.
Any text between // and the end of the line will be ignored by
JavaScript (will not be executed).
This example uses a single-line comment before each code line:
Example
// Change heading:
document.getElementById("myH").innerHTML = "My First Page";
// Change paragraph:
document.getElementById("myP").innerHTML = "My first
paragraph.";
This example uses a single line comment at the end of each line to
explain the code:
Example
let x = 5; // Declare x, give it the value of 5
let y = x + 2; // Declare y, give it the value of x + 2
Multi-line Comments
Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored by JavaScript.
This example uses a multi-line comment (a comment block) to
explain the code:
Example
/*
The code below will change
the heading with id = "myH"
and the paragraph with id = "myP"
in my web page:
*/
document.getElementById("myH").innerHTML = "My First Page";
document.getElementById("myP").innerHTML = "My first
paragraph.";
HTML JavaScript
JavaScript makes HTML pages more dynamic and
interactive.
Example
My First JavaScript
JavaScript Output
Using document.write()
For testing purposes, it is convenient to use document.write():
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<p>My first paragraph.</p>
<script>
document.write(5 + 6);
</script>
</body>
</html>
Using document.write() after an HTML document is loaded, will
delete all existing HTML:
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<p>My first paragraph.</p>
<button type="button" onclick="document.write(5 + 6)">Try
it</button>
</body>
</html>
JavaScript Variables
JavaScript Identifier
Example
let carName;
Re-Declaring JavaScript Variables
If you re-declare a JavaScript variable declared with var, it will not
lose its value.
The variable carName will still have the value "Volvo" after the
execution of these statements:
Example
var carName = "Volvo";
var carName;
Note:You cannot re-declare a variable declared with let or const.
let carName = "Volvo";
let carName;
JavaScript Arithmetic
As with algebra, you can do arithmetic with JavaScript variables,
using operators like = and +:
Example
let x = 5 + 2 + 3;
You can also add strings, but strings will be concatenated:
Example
let x = "John" + " " + "Doe";
Example
let x = "5" + 2 + 3;
Note:If you put a number in quotes, the rest of the numbers will be
treated as strings, and concatenated.
Example
let x = 2 + 3 + "5";
JavaScript Dollar Sign $
Since JavaScript treats a dollar sign as a letter, identifiers containing $
are valid variable names:
Example
let $ = "Hello World";
let $$$ = 2;
let $myMoney = 5;
1. An object
2. An array
3. A date
Examples
// Numbers:
let length = 16;
let weight = 7.5;
// Strings:
let color = "Yellow";
let lastName = "Johnson";
// Booleans
let x = true;
let y = false;
// Object:
const person = {firstName:"John", lastName:"Doe"};
// Array object:
const cars = ["Saab", "Volvo", "BMW"];
// Date object:
const date = new Date("2022-03-25");
JavaScript has dynamic types. This means that the same variable can
be used to hold different data types:
Example
let x; // Now x is undefined
x = 5; // Now x is a Number
x = "John"; // Now x is a String
JavaScript Strings
A string (or a text string) is a series of characters like "John Doe".
Strings are written with quotes. You can use single or double quotes:
Example
// Using double quotes:
let carName1 = "Volvo XC60";
// Using single quotes:
let carName2 = 'Volvo XC60';
You can use quotes inside a string, as long as they don't match the
quotes surrounding the string:
Example
// Single quote inside double quotes:
let answer1 = "It's alright";
// Single quotes inside double quotes:
let answer2 = "He is called 'Johnny'";
// Double quotes inside single quotes:
let answer3 = 'He is called "Johnny"';
You will learn more about strings later in this tutorial.
JavaScript Numbers
All JavaScript numbers are stored as decimal numbers (floating
point).
Numbers can be written with, or without decimals:
Example
// With decimals:
let x1 = 34.00;
// Without decimals:
let x2 = 34;
Exponential Notation
Extra large or extra small numbers can be written with scientific
(exponential) notation:
Example
let y = 123e5; // 12300000
let z = 123e-5; // 0.00123
Note
Most programming languages have many number types:
Whole numbers (integers):
byte (8-bit), short (16-bit), int (32-bit), long (64-bit)
Real numbers (floating-point):
float (32-bit), double (64-bit).
Javascript numbers are always one type:
double (64-bit floating point).
You will learn more about numbers later in this tutorial.
JavaScript BigInt
All JavaScript numbers are stored in a a 64-bit floating-point format.
JavaScript BigInt is a new datatype (ES2020) that can be used to store
integer values that are too big to be represented by a normal
JavaScript Number.
Example
let x = BigInt("123456789012345678901234567890");
You will learn more about BigInt later in this tutorial.
JavaScript Booleans
Booleans can only have two values: true or false.
Example
let x = 5;
let y = 5;
let z = 6;
(x == y) // Returns true
(x == z) // Returns false
Booleans are often used in conditional testing.
You will learn more about booleans later in this tutorial.
JavaScript Arrays
JavaScript arrays are written with square brackets.
Array items are separated by commas.
The following code declares (creates) an array called cars, containing
three items (car names):
Example
const cars = ["Saab", "Volvo", "BMW"];
Array indexes are zero-based, which means the first item is [0],
second is [1], and so on.
You will learn more about arrays later in this tutorial.
JavaScript Objects
JavaScript objects are written with curly braces {}.
Object properties are written as name:value pairs, separated by
commas.
Example
const person = {firstName:"John", lastName:"Doe", age:50,
eyeColor:"blue"};
The object (person) in the example above has 4 properties: firstName,
lastName, age, and eyeColor.
You will learn more about objects later in this tutorial.
Example
typeof "" // Returns "string"
typeof "John" // Returns "string"
typeof "John Doe" // Returns "string"
Example
typeof 0 // Returns "number"
typeof 314 // Returns "number"
typeof 3.14 // Returns "number"
typeof (3) // Returns "number"
typeof (3 + 4) // Returns "number"
You will learn more about typeof later in this tutorial.
Undefined
In JavaScript, a variable without a value, has the value undefined. The
type is also undefined.
Example
let car; // Value is undefined, type is undefined
Example
car = undefined; // Value is undefined, type is undefined
Empty Values
An empty value has nothing to do with undefined.
An empty string has both a legal value and a type.
Example
let car = ""; // The value is "", the typeof is "string"
Test Yourself With Exercises
Exercise:
Use comments to describe the correct data type of the following
variables:
let length = 16;
let lastName = "Johnson";
const x = {
firstName: "John",
lastName: "Doe"
};
HTML DOM
With the HTML DOM, JavaScript can access and change all the
elements of an HTML document.
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document
Object Model of the page.
Example:
<!doctype html>
<html>
<head>
<title>JavaScript</title>
<style>h1{text-align: center;}</style>
</head>
<body>
<h1 id="message">Welcome to JavaScript</h1>
<input name="message">
<button>Click Me</button>
<ul><li class="highlight">One</li><li>Two</li><li
class="highlight">Three</li><li>Four</li></ul>
<div><span class="highlight">Welcome</span> to the JavaScript
DOM. All Elements on this page are objects. <span
class="highlight">Page</span> Elements have properties and
methods accessed <span class="highlight">by JavaScript</span>
</div>
<script src="script.js"></script>
</body>
</html>
JavaScript
OUTPUT:
Module:8
JavaScript advanced coding
Method Description
toString() Returns a number as a string
toExponential() Returns a number written in exponential notation
toFixed() Returns a number written with a number of decimals
toPrecision() Returns a number written with a specified length
ValueOf() Returns a number as a number
Example
let str = "Apple, Banana, Kiwi";
let part = str.substr(7);
If the first parameter is negative, the position counts from the end of
the string.
Example
let str = "Apple, Banana, Kiwi";
let part = str.substr(-4);
String ReplaceAll()
In 2021, JavaScript introduced the string method replaceAll():
Example
text = text.replaceAll("Cats","Dogs");
text = text.replaceAll("cats","dogs");
The replaceAll() method allows you to specify a regular expression
instead of a string to be replaced.
Examples
let text = "5";
let padded = text.padEnd(4,"0");
let text = "5";
let padded = text.padEnd(4,"x");
Math Methods
The syntax for Math any methods is : Math.method(number)
Number to Integer
There are 4 common methods to round a number to an integer:
Math.round(x) Returns x rounded to its nearest integer
Math.ceil(x) Returns x rounded up to its nearest integer
Math.floor(x) Returns x rounded down to its nearest integer
Math.trunc(x) Returns the integer part of x (new in ES6)
Math.round()
Math.round(x) returns the nearest integer:
Examples
Math.round(4.6);
Math.round(4.5);
Math.round(4.4);
Math.ceil()
Math.ceil(x) returns the value of x rounded up to its nearest integer:
Example
Math.ceil(4.9);
Math.ceil(4.7);
Math.ceil(4.4);
Math.ceil(4.2);
Math.ceil(-4.2);
Math.floor()
Math.floor(x) returns the value of x rounded down to its nearest
integer:
Example
Math.floor(4.9);
Math.floor(4.7);
Math.floor(4.4);
Math.floor(4.2);
Math.floor(-4.2);
Math.trunc()
Math.trunc(x) returns the integer part of x:
Example
Math.trunc(4.9);
Math.trunc(4.7);
Math.trunc(4.4);
Math.trunc(4.2);
Math.trunc(-4.2);
Math.sign()
Math.sign(x) returns if x is negative, null or positive:
Example
Math.sign(-4);
Math.sign(0);
Math.sign(4);
Math.trunc() and Math.sign() were added to JavaScript 2015 - ES6.
Math.pow()
Math.pow(x, y) returns the value of x to the power of y:
Example
Math.pow(8, 2);
Math.sqrt()
Math.sqrt(x) returns the square root of x:
Example
Math.sqrt(64);
Math.abs()
Math.abs(x) returns the absolute (positive) value of x:
Example
Math.abs(-4.7);
Math.sin()
Math.sin(x) returns the sine (a value between -1 and 1) of the angle x
(given in radians).
If you want to use degrees instead of radians, you have to convert
degrees to radians:
Angle in radians = Angle in degrees x PI / 180.
Example
Math.sin(90 * Math.PI / 180); // returns 1 (the sine of 90 degrees)
Math.cos()
Math.cos(x) returns the cosine (a value between -1 and 1) of the angle
x (given in radians).
If you want to use degrees instead of radians, you have to convert
degrees to radians:
Angle in radians = Angle in degrees x PI / 180.
Example
Math.cos(0 * Math.PI / 180); // returns 1 (the cos of 0 degrees)
Math.min() and Math.max()
Math.min() and Math.max() can be used to find the lowest or highest
value in a list of arguments:
Example
Math.min(0, 150, 30, 20, -8, -200);
Example
Math.max(0, 150, 30, 20, -8, -200);
Math.random()
Math.random() returns a random number between 0 (inclusive), and 1
(exclusive):
Example
Math.random();
You will learn more about Math.random() in the next chapter of this
tutorial.
The Math.log() Method
Math.log(x) returns the natural logarithm of x.
The natural logarithm returns the time needed to reach a certain level
of growth:
Examples
Math.log(1);
Math.log(2);
Math.log(3);
Math.E and Math.log() are twins.
Prototype Inheritance
All JavaScript objects inherit properties and methods from a
prototype:
Date objects inherit from Date.prototype
Array objects inherit from Array.prototype
Person objects inherit from Person.prototype
The Object.prototype is on the top of the prototype inheritance chain:
Date objects, Array objects, and Person objects inherit from
Object.prototype.
Adding Properties and Methods to Objects
Sometimes you want to add new properties (or methods) to all
existing objects of a given type.
Sometimes you want to add new properties (or methods) to an object
constructor.
Module:9
Coding exercise with JavaScript
JavaScript Closure
A closure in JavaScript is a function that has access to the variables
in its parent scope, even after the parent function has completed
execution.
This allows for data to be "closed over" or remembered by the inner
function, even after the outer function has returned.
For example: function makeCounter() { let count = 0; return
function() {
return count++; } }let counter = makeCounter();
console.log(counter()); // outputs 0 console.log(counter()); // outputs 1
console.log(counter()); // outputs 2
Here, the makeCounter function returns an inner function that has
access to the count variable declared in its parent scope, and can
"remember" the current count value even after the function has
completed execution. Each time the inner function is called, it returns
the current value of count and increments it by
1. const a = 'hello';
console.log(a); abc(); function abc(){ //const a = 'world';
console.log(a); }function myCount(){ let count = 0; return function(){
return count++; } }function myCount2(){ let count = 0 ; return count+
+; }let cnt = myCount(); let cnt2 = myCount2; for(let x=0;x<10;x++){
console.log(cnt());
console.log(cnt2()); }
JavaScript Closure Advanced
This example uses JavaScript to select the elements from the HTML,
and add event listeners to the prev/next buttons to navigate through
the images in the images array when clicked.
The currentIndex variable keeps track of the current image being
displayed, and the currentImage.src property is updated to show the
next/prev image in the array when the buttons are clicked.
The above code is an example of a JavaScript image gallery maker
that creates a simple image gallery with prev/next buttons.
The code uses JavaScript to select the necessary elements from the
HTML, such as the gallery container, current image, and prev/next
buttons. It then adds event listeners to the
prev/next buttons, so that when they are clicked, the current image
being displayed is updated to the next/prev image in the images array.
The currentIndex variable keeps track of the current image being
displayed, and it is updated each time the prev/next buttons are
clicked.
When the current index reaches the end of the images array, it resets
to the first image, thus creating an infinite loop.
Dynamic Image Gallery How to Create an Image Gallery and
Dynamic Image Gallery with JavaScript Code The image gallery can
also be used within a function to create multiple image galleries all
working independently.
Either creating them on the fly within the code or selecting existing
elements with the class name and generating images within those
elements.
const output = document.querySelector('.output');
const images = ['one.jpg','two.jpg','three.jpg','four.jpg']; /*for(let
x=0;x<12;x++){ const el = document.createElement('div');
output.append(el); cGallery(el); }
Module:10
Simple web site from starch
Build a Website
Create a Website with a CSS Framework
Start Page Template
Ever heard about W3Schools Spaces? Here you can create your
website from scratch or use a template.
* no credit card required
A "Layout Draft"
It is always wise to draw a layout draft of the page design before
building a website.
Having a "Layout Draft" will make it a lot easier to create a web site:
</body>
</html>
Module:11
HTTP request in Javascript Get JSON data with xhr method and fetch
methods HTTP request in Javascript? There are several ways to make
an HTTP request in JavaScript, including using the XMLHttpRequest
object or the fetch() function.
Here is an example of making an HTTP GET request using
XMLHttpRequest: var xhr = new XMLHttpRequest();
xhr.open("GET", "https://example.com");
xhr.send(); Here's an example of making an HTTP GET request to a
JSON endpoint using the XMLHttpRequest object and parsing the
response as JSON: var xhr = new XMLHttpRequest();
xhr.open("GET", "https://example.com/data.json"); xhr.onload =
function() { if (xhr.status === 200) { var data =
JSON.parse(xhr.responseText); console.log(data); } else
{ console.error(xhr.statusText); } };xhr.onerror = function()
{ console.error(xhr.statusText); };xhr.send(); In this example, a new
XMLHttpRequest object is created, and then opened with the "GET"
method and the specified JSON endpoint URL. The onload event is
used to handle the response, and onerror event is used to handle any
error. The xhr.status is checked and if it's 200, it indicates that the
request is successful, then we parse the response as JSON and log the
data to the console. If the xhr.status is not 200, it means there's an
error and it logs the error message in the onerror function. If there's
any network error, the onerror function is triggered, and it logs the
error message. Finally the request is sent using the xhr.send() method.
Please note that you should always check the response status code and
handle it accordingly. Also, XMLHttpRequest is an old API, and
fetch() is more modern and recommended The fetch() method is a
modern JavaScript method that allows you to make HTTP requests,
similar to the XMLHttpRequest object.
The fetch() method returns a promise that resolves to the response of
the request, which can be a Response or Error object. When you call
the fetch() method, you pass in the URL of the endpoint you want to
make the request to.
Module:12
You can also pass in an options object as the second parameter, which
allows you to configure the request, such as setting the HTTP method,
headers, and body.
The fetch() method returns a promise that resolves to the response of
the request. Once you have the response, you can use
the .json(), .text(), .blob() methods, etc to access the data of the
response. Here's an example of how you can use the fetch() method:
fetch("https://example.com/data.json") .then(response =>
response.json()) .then(data => console.log(data)) .catch(error =>
console.log(error)); In this example, the fetch() method is used to
make a GET request to a JSON endpoint. The .then() method is used
to handle the response, which is passed as a parameter to the first
callback function. The response.json() method is used to parse the
response as JSON and the result is passed to the second callback
function.
Finally, the data is logged to the console. If there's anyerror during
the request, it will be caught and logged by the catch function.
The fetch() method is a more modern and recommended way to make
HTTP requests in JavaScript, it's more concise and easy to use, and
it's supported in most modern browsers. And here is an example of
making an
<small>${JSON.stringify(ele)}</small>`; })output.innerHTML +=
'<hr>'; }JSON Code [ { "name": { "first": "Laurence", "last": "Svekis"
},"age": 40, "location": { "city": "Toronto", "country": "Canada" } },{
"name": { "first": "Lisa", "last": "Suekis" },"age": 30,
"location": { "city": "New York", "country": "USA" } },{ "name":
{ "first": "Johyn", "last": "Sekis" },"age": 50, "location": { "city":
"New York", "country": "USA" } } ]How to add Fade Out and Fade
in to page elements pure JavaScript Learn how to apply fade in and
fade out effects to HTML page elements with pure JavaScript code.
Select and create new page elements dynamically with code, add
event listeners and have the page elements fade in and fade out once
the event is triggered. Adding Fade Effects to new and existing Page
Elements
const output = document.querySelector('#output'); for(let x=0;x<5;x+
+){ const el = document.createElement('div'); output.append(el);
const btn = document.createElement('button'); btn.textContent =
`Click Me ${x}`; el.append(btn); const div =
document.createElement('div');
module:13
Create page HTML elements with JavaScript code append prepend
before after pure JavaScript How to append and add new page
elements with JavaScript How to append and add new page elements
with JavaScript using append, appendChild, prepend, before and after
methods to dynamically add and reposition page elements
Laurence Svekis https://basescripts.com/
Create Page elements with Code How to append and add new page
elements with JavaScript
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Course</title>
</head>
<body>
<div> <input type="text" id="nums">
<button id="btn">Checker</button>
</div>
<script src="app.js">
</script>
</body>
</html>
const nums = document.querySelector('#nums'); const btn =
document.querySelector('#btn'); btn.onclick = ()=>{ const inputValue
= nums.value; const patt = /^[0-3]*$/g; const results =
inputValue.match(patt); console.log(results); const valNum = results !
= null; console.log(valNum); }
JavaScript is a function that has access to variables in its parent scope,
even after the parent function has returned.
Closures are created when a function is defined inside another
function, and the inner function retains access to the variables in the
outer function's scope.
Here is an example of a closure in JavaScript: code example function
outerFunction(x) { var innerVar = 4; function innerFunction() { return
x + innerVar; }return innerFunction; }var closure = outerFunction(2);
console.log(closure()); // Output: 6 In this example, the innerFunction
is a closure because it has access to the variable x and innerVar from
the outerFunction even after outerFunction has returned. A closure
has three scope chains:
1. It has access to its own scope (variables defined between its curly
braces {}).
2. It has access to the outer function's variables.
3. It has access to the global variables. Closures are commonly used
in JavaScript for a variety of tasks, such as:
● Implementing private methods and variables.
● Creating callback functions that retain access to variables from
their parent scope.
● Creating and returning an object that has access to variables from
its parent scope.
JavaScript closures are an important concept and it is important to
understand how closures work in JavaScript. It is also important to be
aware of the scope chain, and how closures interact with the scope
chain.
<!DOCTYPE html>
<html>
<head>
<title>Learn JavaScript</title>
</head>
<body>
<h1>Complete JavaScript Course </h1>
<div class="output"></div>
<script src="app6.js"></script>
</body>
</html>
const val1 = 10;
function outerFun(x){
const val2 = 10;
function innerFun(){
Laurence Svekis https://basescripts.com/
return x + val2 + val1; }
return innerFun; }
const val3 = outerFun(15);
console.log(val3());
for(let x=0;x<10;x++){
console.log(outerFun(x+2)());
}
Module:14
Web design and web development resources and helpful tips and
lesson
Github and gitpages getting started with GitHub and git
HTML
<!doctype html>
<html>
<head>
<title>JavaScript</title>
<style>h1{text-align: center;}</style>
</head>
<body>
<h1>Welcome to JavaScript</h1>
<button onclick='alert("hi");'>Click Me</button>
<script src="script.js"></script>
</body>
</html>
JavaScript
alert('hello');
OUTPUT:
Ex:9 JAVASCRIPT USING QUERY SELECTOR
<!doctype html>
<html>
<head>
<title>Example querySelectorAll</title>
</head>
<body>
<ul></ul>
<input type="text" name="myInput" value="test">
<button>Click Me to add item</button>
<script>
const ul = document.querySelector('ul');
const li = document.querySelectorAll('li');
const myInput = document.querySelector('input[name="myInput"]');
const btn = document.querySelector('button');
let x = 0;
let val = myInput.value;
btn.addEventListener('click', (e) => {
//console.log(e);
x++;
e.target.textContent = 'Clicked ' + x;
addListItem();
})
function addListItem() {
//console.log(myInput.value);
//console.log(val);
console.dir(ul);
console.log(ul.children.length);
console.log(ul.childElementCount);
const lis = document.querySelectorAll('li');
//console.log(lis.length);
}
</script>
</body>
</html>
OUTPUT:
Ex:10 JAVASCRIPT WITH STICKY NAVBAR
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-
scale=1">
<title>Single Page Site Sticky Navbar Bottom</title>
<link rel="stylesheet" href="style.css"> </head>
<body>
<div id="navbar">
<nav> <a href="#home" class="active">Home</a> <a
href="#about">About</a> <a href="#products">Products</a> <a
href="#contact">Contact</a> </nav>
</div>
<div id="wrapper">
<header>
<div>
<h2>Welcome to my Website</h2>
<p>Content</p>
</div>
</header>
<section id="home">
<article>
<h2>Home</h2>
<p><strong>Pellentesque habitant morbi tristique</strong>
senectus et netus et malesuada fames ac turpis egestas. Vestibulum
tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec
eu libero sit amet quam egestas semper. <em>Aenean ultricies mi
vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et
sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed,
<code>commodo vitae</code>, ornare sit amet, wisi. Aenean
fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci,
sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a>
in turpis pulvinar facilisis. Ut felis.</p>
</article>
</section>
<section id="about">
<article>
<h2>About</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat
vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet
quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat
eleifend leo.</p>
</article>
</section>
<section id="products">
<article>
<h2>Products</h2>
<ul>
<li><img src="birds.png">
<p>My Birds</p>
</li>
<li><img src="img1.png">
<p>My Image 1</p>
</li>
<li><img src="img2.png">
<p>My Image 2</p>
</li>
<li><img src="img3.png">
<p>My Image 3</p>
</li>
</ul>
</article>
</section>
<section id="contact">
<article>
<h2>Contact</h2>
<form>
<div class="row">
<label for="name">Name:</label>
<input type="text" name="name" placeholder="Your Name">
</div>
<div class="row">
<label for="name">Email:</label>
<input type="email" name="email" placeholder="Your
Email"> </div>
<div class="row">
<button type="submit">Send Email</button>
</div>
</form>
</article>
</section>
</div>
<footer id="footer">
<div>© Copyright 2020 more company info.</div>
</footer>
</body>
</html>
CSS
/*
CSS HEX
--onyx: #393e41;
--timberwolf: #d3d0cb;
--platinum: #e7e5df;
--keppel: #44bba4;
--maize-crayola: #e7bb41;
*/
@import url('https://fonts.googleapis.com/css2?
family=Roboto+Slab&display=swap');
*{
box-sizing: border-box;
}
body,
html {
height: 100vh;
font-family: 'Roboto Slab', serif;
}
a{
text-decoration: none;
color: #44bba4;
}
a:hover {
text-decoration: none;
color: #393E41;
}
article h2 {
text-transform: uppercase;
font-size: 3em;
}
#navbar {
position: fixed;
top: 0px;
left: 0px;
background-color: #393E41;
display: block;
width: 100%;
z-index: 100;
height: 60px;
}
#navbar nav {
display: flex;
}
#navbar nav a {
flex: 0 0 25vw;
text-align: center;
font-size: 2em;
background-color: #D3D0CB;
}
#wrapper {
margin-top: 60px;
}
#wrapper header {
min-height: 500px;
padding: 4px;
background-color: #E7BB41;
background: url(birds.png) no-repeat center center fixed;
background-size: cover;
}
#home {
background-image: url(img1.png);
}
#about {
background-image: url(img2.png);
}
#products {
background-image: url(img3.png);
}
#products ul {
margin: auto;
padding: 0;
list-style-type: none;
display: flex;
flex-wrap: wrap;
align-items: center;
text-align: center;
justify-content: center;
}
#products ul li {
margin: 10px;
text-align: center;
background-color: white;
}
#products ul li img {
box-shadow: 3px 3px 8px 0px rgba(0, 0, 0, 0.3);
max-width: 35vw;
border: 4px solid #000;
margin: 10px;
}
#contact {
background-image: url(birds.png);
}
#contact form {
margin: 0 auto;
max-width: 50vw;
border: 1px solid #ddd;
padding: 20px;
border-radius: 20px;
background-color: #44BBA4;
}
#contact label {
display: block;
width: 100%;
text-align: left;
margin-bottom: 20px;
font-size: 1.2em;
color: white;
}
#contact .row {
margin: 20px auto;
padding: 0 50px;
}
#contact input {
width: 100%;
font-size: 1.2em;
height: 55px;
border-radius: 10px;
padding-left: 10px;
}
#contact button {
padding: 15px;
width: 100%;
font-size: 1.4em;
background-color: #E7BB41;
}
#footer {
background-color: #393E41;
color: #E7E5DF;
padding: 20px;
text-align: center;
min-height: 200px;
}
@media all and (max-width:640px) {
#navbar nav a {
flex: 0 0 25vw;
font-size: 1.2em;
}
#navbar {
height: 30px;
}
#wrapper header > div {
width: 100%;
}
#wrapper header {
min-height: 100px;
}
#products ul li img {
box-shadow: 3px 3px 8px 0px rgba(0, 0, 0, 0.3);
max-width: 100%;
margin: 0px;
}
#contact form {
max-width: 100%;
}
}
OUTPUT: