Web Science Chapter 4
Web Science Chapter 4
Chapter 4
Introduction to HTML
• Files that travel across the largest network in the world, the Internet, and
carry information from a “server” to “client” that requested them are called
“webpage”.
• The language used to develop webpage is called Hyper Text Markup
Language (HTML).
• HTML stands for HyperText Markup Language.
• It is the standard language used to create and structure content on the web.
• HTML is a markup language, not a programming language, meaning it
annotates text to define how it is structured and displayed by web browsers.
• It forms the building blocks of all websites and is complemented by CSS for
style and JavaScript for interactivity.
• HTML was created by Tim Berners Lee at European Laboratory for
Particle Physics (CERN) in late 1980’s.
• In 1992, Marc Anderson Created MOSAIC, first graphic interface for
HTML documents at UIUC. (University of Illinois at Urbana
Champaign)
HTML Features
• It is simple and an open standard
• It is fairly easy to learn
• It is good at presenting text and graphic in a reasonably decent layout
• Its files are tiny.
• It allows the view of information online through the use of interactive
form.
• Its browsers are cheap or free, very powerful; with a combination of
third party add-ins and server side content support, a vast range of
information is being delivered through HTML language
• HTML document browser interfaces are easy to build into existing
products because of the simplicity of HTML
• HTML pages allow link to any other publicly accessible page simply by
entering the address
• There are some specialized structures in HTML, but they are mostly
used to effect a certain formatting look
• It permits a variety of other enhancement other than internal and
external hyperlinks
• It is interactive
Structure and syntax
• <!DOCTYPE HTML>: The <!DOCTYPE html> declaration is placed at the
beginning of the document. It tells the browser that the document follows
HTML5 standards, ensuring consistent rendering across browsers.
• <html> Tag: The <html> tag wraps the entire document, serving as the root
element of an HTML page. It typically includes the lang attribute to specify the
language of the content.
• <head> Section: The <head> section contains metadata, scripts, styles, and
other information not displayed directly on the page but essential for
functionality and SEO.
• <body> Section: The <body> section contains all the visible content of the web
page, including text, images, videos, links, and more. This is where you’ll add the
main elements to display on the page.
HTML forms
• HTML Forms use the <form> tag to collect user input through various
interactive controls.
• These controls range from text fields, numeric inputs, and email fields
to password fields, checkboxes, radio buttons, and submit buttons.
• Syntax:
• <form>
• <!--form elements-->
• </form>
• Form Elements
• The HTML <form> comprises several elements, each serving a unique
purpose.
• For instance, the <label> element defines labels for
other <form> elements.
• On the other hand, the <input> element is versatile and can be used
to capture various types of input data such as text, password, email,
and more simply by altering its type attribute.
Elements Descriptions
<label> It defines labels for <form> elements.
It is used to get input data from the form in various types such as text, password, email, etc
<input>
by changing its type.
<fieldset> It is used to draw a box around other form elements and group the related data.
Allows the user to enter a number. You can specify min, max, and step attributes
<input type=”number”>
for range.
Commonly Used Input Types in
HTML Forms
Input Type Description
<input type=”checkbox”> Used for checkboxes where the user can select multiple options.
• <website>
• <name>GeeksforGeeks</name>
• <company>GeeksforGeeks</company>
• <phone>011-24567981</phone>
• </website>
• Rule 2: XML Documents must have a root element (the supreme
parent element) and its child elements (sub-elements). To have a
better view of the hierarchy of the data elements, XML follows the
XML tree structure which comprises of one single root (parent) and
multiple leaves (children).
<?xml version="1.0" encoding="UTF-8"?>
• <website>
• <company category="geeksforgeeks">
• <title>Machine learning</title>
• <author>aarti majumdar</author>
• <year>2022</year>
• </company>
• <company category="geeksforgeeks">
• <title>Web Development</title>
• <author>aarti majumdar</author>
• <year>2022</year>
• </company>
• <company category="geeksforgeekse">
• <title>XML</title>
• <author>aarti majumdar</author>
• <year>2022</year>
• </company>
• </website>
• Rule 3: All XML Elements are required to have Closing and opening
Tags(similar to HTML).
• <message>Welcome to GeeksforGeeks</message>
• Rule 4: The opening and closing tags are case-sensitive. For
Example, <Message> is different from <message> from above
example.
• <Person>
• <First_Name>John</First_Name>
• <Last_Name>Doe</Last_Name>
• <DOB>1968-11-24</DOB>
• <State></State>
• <Postcode id=""/>
• </Person>
XML parser
• The XML DOM (Document Object Model) defines the properties and
methods for accessing and editing XML.
• However, before an XML document can be accessed, it must be
loaded into an XML DOM object.
• All modern browsers have a built-in XML parser that can convert text
into an XML DOM object.
• <html>
<body>
<p id="demo"></p>
<script>
var text, parser, xmlDoc;
text = "<bookstore><book>" +
"<title>Everyday Italian</title>" +
"<author>Giada De Laurentiis</author>" +
"<year>2005</year>" +
"</book></bookstore>";
document.getElementById("demo").innerHTML =
xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
</script>
</body>
</html>
• Output
• Everyday Italian