UNIT - 4 - Copy-1
UNIT - 4 - Copy-1
UNIT -4
Web Development
At the end of this unit, students will be able to:
Visit the following webpage for the list of all html tags:
https://www.w3schools.com/tags/default.asp
CONT…
HTML elements are components of an HTML
document and normally have a <start tag> followed by
content and an </end tag>.
HTML elements are the building blocks of a webpage.
HTML Code
<h1>This is a heading</h1>
<p>This is a paragraph</p>
<b>This is a bold text</b>
<i>This is an italic text</i>
Output on the Web Browser
This is a heading
This is a paragraph
This is a bold text This is an italic text
CONT.….
there are some HTML elements that have a different
format. These HTML elements are known as void elements.
The following table shows the format of void elements and
their meanings. Void elements do not have an end tag.
HTML CODE
<hr >
<p>This is a <br> paragraph </p>
<hr >
Output on the Web Browser
4.3.2 STRUCTURE OF HTML DOCUMENTS
All HTML documents or webpages have a common structure. What
changes from one webpage to another is what goes inside the
<body> and the <head> sections of HTML documents.
<!DocumentType html>
<html>
<head>
<title>
This is document title
</title>
</head>
<body>
<h1>This is a heading</h1>
<p>Document content goes here.....</p>
</body>
</html>
CONT.…..
<!DOCTYPE html>: this element indicates the type of
the document.
<html> …</html>: represents the entire document,
and it is divided into two major sections: the head
(<head>..</head>) and the body (<body>…</body>)
sections.
<head>..</head>: this part of the HTML document is
used to keep all the information about the webpage such
as the page title.
<body>…</body>: is the part of the HTML document
where the content of the webpage is kept. Everything that
is shown in the web browser, when the webpage is
displayed, is what is contained in this part of the HTML
document.
Activity 1
Lets create our first web page.
Open Notepad and write the following HTML code
<HTML>
<HEAD>
<TITLE>HTML Training</TITLE>
<!--This page is created by G-11-->
</HEAD>
<BODY>
<P>On this page we're reviewing the different types of tags that we've learned in this chapter.</P>
<P>In the second paragraph, I'm going to include the class’s I’ve taken up to now.<BR>
Information system<BR>
Artificial Intelligence<BR>
Augmented and Virtual Reality<BR>
Data Science<BR>
</P>
<HR>
<P><EM>first </EM> practice</P>
<!—additional description can be added here.-->
</BODY>
</HTML>
After writing the code save the document as myfirstpage.html.
Open the saved file myfirstpage.html using a web browser and see your first web page
4.3.3 HTML ATTRIBUTES
HTML attributes are used to define more properties to
HTML elements. HTML paragraphs, for example, are
left-aligned by default. However, if a paragraph is needed
to be presented with the texts aligned to the right, the
“align” attribute should be used.
Attributes are written inside the start tag with attribute-
value pairs(attribute=value).
HTML Code
<h1>This is a heading</h1>
<p align=“right” > This is a paragraph </p
Output on the Web Browser
This is a heading
This is a paragraph
CONT….
Attributes are normally optional to many of the HTML
tags.
However, there are some HTML elements that cannot
function
The <img> HTML element is one such example. The
<img> element should have the “src” attribute, which
refers to the name and location of the actual image that
is required to be inserted into the webpage.
<img src=“filename of the image.jpg” >
the image file and the HTML file must be located in the
same folder.
CONT….
The other HTML element that uses the “src” attribute is
the <video> element.<video> element is used to add a
video to a web page .
example.
<video width=”320” height=”200” controls
src=”Country Landscape.mp4” >
</video>
4.4. HTML LINKS
HTML links are used to navigate from one webpage to
another or from one part of a webpage to another.
The links could come in the form of text or images and
are normally known as hyperlinks.
4.4.1 Links to other Pages
The anchor tag (<a>) is used to create hyperlinks.
CONT……
E.g.
<a href=“http://www.google.com”>Google </a>
Output on the Web Browser
Google
In addition to texts, images can also be used as links
that users can click on to go to a specified webpage.
<a href=http://www.google.com target=“_parent”> <img
src=“google.png”> </a>
Output on the Web Browser
CONT….
Absolute URL: is a URL that includes every element of
a URL such as the protocol, the hostname, as well as
path of the webpage. In other words, it will have a form
such as this
http://www.somewebsite.com/somefile.html
Relative URL: is a path given relative to the location of
the current webpage.
Example: some directory/somefile.html
Activity 2
Add the following code in Notepad and save it as practice.html and open it using any web browser.
<html>
<head>
<title>Heading Example</title>
</head>
<body>
<h1>This is <u>underlined</u> heading 1</h1>
<p>Here is a first paragraph of text.</p>
<h2>This is heading 2</h2>
<p>Here is a second paragraph of text.</p>
<h3>This is heading 3</h3>
<a href=”www.gmail.com”> Go to Gmail</a>
<img src=””> <!—insert a picture from your computer here-->
<h4>This is <i>italic</i> heading 4</h4>
<p>This text is not in the center.</p> <center>
<p>This text is in the center.</p> </center>
<h5>This is <i>italic</i> heading 5 </h5>
<p>This is paragraph one and should be on top</p>
<hr />
<p>This is paragraph two and should be at bottom</p>
<h6>This is heading 6</h6>
</body>
</html>
4.4.2 LINKS TO PAGE SECTIONS
the <a> tag is used in two different ways: in
designating names to specific locations and in creating
links to the locations from other places on the same page.
Example:
<h3>Section One
<a name=”section_one”></a>
</h3>
<a href=”#section_one”>Go to section
one</a>
4.5. HTML TABLES
An HTML table is used to organize data in terms of
rows and columns. Tables are one way of organizing
contents or defining a layout for contents in a webpage.
Example:
<ol>
<li>File system</li>
<li>ntfs</li>
<li>exfat</li>
<li>Fat32</li>
</ol>
4.6.2 Unordered List
seen earlier.
First Name, Last Name – text
Age - text
select box
Mobile Number – text
Checkboxes
CSS(CASCADING
STYLE SHEETS)
outcomes
What is CSS?
CSS (Cascading Style Sheets) is a scripting language
used to format web pages.
CSS helps web pages to be more presentable through the
use of lots of formatting options including fonts,
spacing, paragraph, blocks, images, borders, headers etc.
CSS works with HTML and is mainly used to embed
rules of styles on HTML tags.
Advantages of CSS :
Adds a style to HTML
Easy to edit and modify
Platform independence
CSS Saves time…….
Types of Css: Internal, Extenal,and InlineCss.
CSS SYNTAX
A CSS comprises of style rules that are interpreted by the
browser and then applied to the corresponding elements in
your document. A style rule is made of three parts:
1. Selector: A selector is an HTML tag at which a
style will be applied. This could be any tag.
2. Property: A property is a type of attribute of HTML
tag. Properties have to be based on global standards.
3.Value: Values are assigned to properties. SYNTAX
selector { property: value }
E.g. p{color : blue;} //set the color of a paragraph to blue
h1 {
color: yellow; //set the color of Header 1 to
font-size:14px; //set the font size to 14 pixels }
Selectors
There are different kinds of selectors that are used to
format tags.:
Type selector: Works for specific elements.
E.g h1 { color: #36CFFF; }
Class selector: Used to define style rules based on the
class attribute of the elements. All the elements
having that class will be formatted according to the
defined rule.
E.g .black { color: #000000; } //this is used in external
CSS
After .black is defined it can be applied to a header as
follows:
h1.black { color: #000000; }
Multiple Style
External CSS
External style sheet is a separate text file with .css
extension. You define all the Style rules within this text
file and then you can include this file in any HTML
document using <link> element.
The <link> element can be used to include an external
style sheet file in your HTML document. The CSS file is
stored in the web page files in the same or separate folder.