Web Programmimg Mod1
Web Programmimg Mod1
HTML -
• It is a markup language commonly used to create webpages
• It describes the structure of the webpage
• HTML is developed and maintained by world wide web consortium(W3C).
• It is derived from a more general markup language called Standard Generalized Markup
Language(SGML), which is an International Organization for Standardization (ISO) technology
that defines markup language.
• In HTML, HyperText simply means "Text within Text." A text has a link within it, is a
hypertext. Markup language: A markup language is a computer language that is used to apply
layout and formatting conventions to a text document.
• In HTML, the term hyper signifies the navigation from one location to another in a non linear
fashion. In other words, clicking a hypertext on a Web page takes you to the relevant page on
the Website or Internet, which is not necessarily the next page on the Website.
• HTML5 is the latest version of HTML, which was released in October 2009. HTML introduces a
number of new elements and attributes, such as AUDIO, VIDEO, and contentEditable, which
allow you to create more interactive Web applications and websites.
Example <script>
document.write("Hello JavaScript by JavaScript");
</script>
CSS -
CSS stands for Cascading Style Sheet, which describes the appearance and formatting of a
web document, and how HTML elements are to be displayed on screen.
XHTML it is a standard markup language for displaying web applications. It combines the
features of HTML and XML., and considered as a restrictive subset of SGML. XML is used to
describe data, while HTML is used to display data; therefore, their combination is a powerful
language.
It defines various types of modules, such as text and hypertext.
ASP.NET –
It is a web development model, which is used to deliver interactive and data-driven web
applications over the internet.
It consists of large number of controls such as, text boxes, buttons and labels for
assembling , configuring and manipulating code to create HTML pages.
PHP it is scripting language used to create dynamic web pages. It is an interpreted language
that is executed on server side.
It can be deployed on any Web server, operating system or platform, such as
Windows, UNIX and Linux and supporst various databases, such as MySQL,
Oracle, Informix.
In an HTML page the PHP code is enclosed within special PHP tag, <? php, and ?>.
Attributes: these are used to provide additional information about the properties and
behavior of HTML elements.
Tags : HTML elements are represented by an opening and closing tag using <and> sign. The
closing tags are written as </name of the tag>
Elements are divided into two categories :
Container elements : it contains text or other tags ; it has both opening and closing tag
example : <title> container element </title>
Empty elements : they do not have any content they are used for inserting a line break
or an image.
Example :<BR/>, <HR/>,<link>
<!DOCTYPE html>
<html>
<body>
<p>This is a <br> paragraph with a line break.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph <hr> with a line break.</p>
</body>
</html>
Understanding elements
The structure of an html element consists of three basic components:
• opening tag
• closing tag
1) Root 5) Flow
2) Metadata 6) Phrasing
3) Section 7) Embedded
4) Heading 8) Interactive
1. Root :
This represents the main or the starting element that should be present in all the HTML
documents.
The HTML element is the first element that comes after the <! DOCTYPE> element & within which
other HTML elements are specified. This element allows the browser to identify the document type.
2. Metadata Elements -
These are used to set the presentation or behavior of the remaining content of a document.
The elements can also be used to set a relationship of a document with other documents.
Attributes Description
Class Specifies the class of an element in an HTML document
2. BASE-
It is used to specify a default URL and target for all the links in an HTML document. You can set
a base URL for all the links once at the top of the document by using the BASE element. This
element appears within the HEAD element of the document & should be used as the first
element in the HEAD element.
Attributes Description
Href Specifies a URL in an HTML document
Target Specifies the locations where the links of an HTML document open. The
following are the four possible values of the target attribute:
_blank : Opens the link in a new window.
_parent : Opens the link in the same frame the link is clicked.
_self : Opens the link in the present framework.
_top : Opens the link in the same window.
<framework> : Opens the link in the respective frame.
<!DOCTYPE HTML>
<HTML>
<HEAD>
<BASE href= “url” target=“value”/>
</HEAD>
</HTML>
The <a> tag defines a hyperlink, which is used to link from one page to another. The
most important attribute of the <a> element is the href attribute, which indicates the link's
destination.
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<base href="https://en.wikipedia.org/wiki/" target="_blank”/>
</head>
<body>
<h1>Welcome Programmers</h1>
<p> attributes of the base element</p>
<a href="HTML_attribute">click here</a> <br />
</body>
</html>
3. LINK -
It is used to link an HTML document to other HTML documents.
It defines relationship between 2 different html documents.
It contains href attribute to specify the destination URL of a link. The href attribute is a
required attribute that must have a valid URL. If this attribute is not specified, then the LINK
element does not define a link.
The LINK element also contains rel attribute that defines the relationship of the linked
documents. This attribute is also a required attribute and must have a valid value.
Attributes Values Description
Href URL Specifies the target URL you navigate to after clicking a
link
Rel Alternate, Specifies the relationship between the HTML document
author, and thetarget URL or another HTML document
first,index,next
<!DOCTYPE html>
<html>
<head>
<link href="styles.css" rel="stylesheet" > <!--linking css file-->
</head>
<body><h1>Hello World!</h1>
<h2>linked style sheet.</h2>
<p>paragraph here</p>
</body></html>
Css file– (style.css)
*{
display: block; font-size: 20px;
}
h1 {
background-color: #05c46b;
font-family: Verdana;text-align: center;
}
NOTE - In HTML, px stands for "pixel" and is a unit of measurement used to specify the
size of elements on a webpage.
4. META element-
The META element is used to provide information about an HTML document, such as
page description and keywords. This element appears inside the HEAD element & has
five attributes : charset, content, http-equiv, name and scheme, from which only
content is a required attribute.
Metadata will not be displayed on the page, but is machine parsable.
Metadata is used by browsers (how to display content or reload page), search engines
(keywords), and other web services.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content=“web class">
<meta name="keywords" content="HTML, CSS, XML, JavaScript">
<meta name="author" content=“author1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>All meta information goes in the head section...</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<h1>Hello</h1>
</head>
<body>
<menu label="cars">
<command type="radio" radiogroup="cars" label="Ferrari"/>
<command type="radio" radiogroup="cars" label="Lamborgini"/>
</menu>
</body>
</html>
6. NOSCRIPT -
The <noscript> tag defines an alternate content to be displayed to users that have
disabled scripts in their browser or have a browser that doesn't support script.
The <noscript> element can be used in both <head> and <body>. When used inside
<head>,the <noscript> element could only contain <link>, <style>, and <meta>
elements.
7. SCRIPT-
The <script> tag is used to embed a client-side script (JavaScript). The <script>
element either contains scripting statements, or it points to an external script file
through the src attribute.
<!DOCTYPE html>
<html>
<body>
<h1> noscript element </h1>
<p>A browser with JavaScript disabled will show the text inside the noscript
element("Hello World!" will not be displayed).
</p>
<script>
document.write("Hello World!")
</script>
<noscript>browser does not support JavaScript!</noscript>
</body>
</html>
Attributes of script
Attribute Value Description
Src URL Specifies the URL of a file that contains the script
<!DOCTYPE html>
<html>
<body>
<h1>The script element</h1>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
</body>
</html>
The innerHTML property sets or returns the HTML content (inner HTML) of an element.
8. STYLE:
The <style> tag is used to define style information (CSS) for a document
It is used to declare the style sheets within the HTML document.
It has 3 attributes: type, media, scoped.
<!DOCTYPE html>
<html>
<head>
<style>
h1 {color: red;}
p {color:blue;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Media media_query Specifies what media/device the media resource is optimized for
3. SECTION -
These are used to define the scope of header, footer and various other sections of
an HTML document like -
a) <BODY> which contains the main content of the document, it includes texts,
hyperlinks,images, and lists.
c) <nav> it is used to navigate from one HTML page to another. It displays a group of
links on an HTML document and to go to particular page we can click the link
associated with that page.
d) <ARTICLE> it used to represent a section that contains the information about an html
page, such as title and date of its creation.
<!DOCTYPE html>
<html>
<body>
<section>
<h1>section content</h1>
</section>
<nav>
<h1>navigation content</h1>
<a href="a.html">articles</a>
</nav>
<aside style="float:right;width:100px;">
<p> this is the aside attribute</p>
</aside>
<article>
<header>
<h1>A heading here</h1>
<p>Posted by John Doe</p>
<p>Some additional information here</p>
</header>
<p>Lorem Ipsum dolor set amet....</p>
<address>
<p>name: aaaa</p>
</addres>
<footer>
<p>copyright @ 2022</p>
</footer>
</article>
</body>
</html>
4. Heading -
It is used to create headlines of text
A heading element is defined as <Hn>, where n is 1 to 6
<!DOCTYPE html>
<html>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
5. Flow it is used in the body of HTML document or applications. Elements of HTML that
are used to display different types of content, such as plain text, links, images in the
HTML document.
6. Phrasing used to represent the text of the HTML document <audio>, <button>, <br>
7. Embedded used to import content from other sources into the HTML document
<video>,<img>, <iframe>
8. Interactive these for user interaction. <audio>, <video>, <img>
Logical elements –
Logical elements in HTML, also known as semantic or idiomatic tags. Logical tags are used to
tell the browser what kind of text is written inside the tags. They are different from physical
tags because physical tags are used to decide the appearance of the text and do not provide any
information about the text.
Some cases when we could use logical tags are:
When we want to write code on our website.
When we want to Emphasize some text.
When we want to display the abbreviation on the Web page.
When we want to display some famous quotation on our web page.
When we want to write some mathematical formula in terms of variables.
Tag Description
Defines the deleted text and is used to mark a portion of text which has been deleted
<del> from the document.
<strong> Defines strong text i.e. show the importance of the text.
<!DOCTYPE html>
<html>
<body>
<img src="img_typo.jpg" alt="Girl with a jacket">
<p>If we try to display an image that does not exist, the value of the alt attribute will be
displayed instead. </p>
</body>
</html>
Bold increases the importance of the text because bold tag convert the text
<b> Bold
into bold size.
<i> Italic An Italic tag is used to define a text with a special meaning.
Big tag increase the font size by 1 (Note: You can not use the big tag in
<big> Big
HTML 5)
<small> Small A small tag defines the small text, and it is used while writing copyright.
<sup> Superscript Superscript is usually used for showing elements above base-line
Strike-
<strike> It is an editing markup that tells the reader to ignore the text passage.
through
<tt> Teletype text Teletype text gives the default font-family which is monospace.