HTML New Document
HTML New Document
BY
&
Assistant Professor,
NAME:____________________
CLASS:____________________
                             1
                                    Syllabus
UNIT – I
Introduction: Web Basics: What is Internet – Web browsers – What is Webpage –
HTML Basics: Understanding tags.
UNIT – II
Tags for Document structure (HTML, Head, Body Tag). Block level text elements:
Headings paragraph (<p>tag) – Font style elements: (bold, italic, font, small, strong,
strike, bigtags)
UNIT – III
Lists: Types of lists: Ordered, Unordered – Nesting Lists – Other tags: Marquee, HR,
BR - Using Images – Creating Hyperlinks.
UNIT – IV
Tables: Creating basic Table, Table elements, Caption – Table and cell alignment –
Rowspan, Colspan – Cell padding.
UNIT – V
Frames: Frameset – Targeted Links – No frame – Forms: Input, Textarea, Select,
Option.
                                           2
                                      UNIT 1
INTRODUCTION TO HTML
INTRODUCTION:
What is HTML?
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
OUTPUT:
My First Heading
My first paragraph.
                                          3
Example Explained
An HTML element is defined by a start tag, some content, and an end tag:
The HTML element is everything from the start tag to the end tag:
                                         4
             <p>            My first paragraph.            </p>
    Some HTML tags are comment less like <br> this tag consider as empty
tag.
WEB BASICS:
    The <head> section typically contains metadata such as the title of the
     page, character set declarations, and links to external resources.
EXAMPLE:
<!DOCTYPE html>
<html>
<head>
                                        5
</head>
<body>
</body>
</html>
HTML Elements:
Example: <p> is a paragraph tag, <h1> to <h6> are heading tags, <a> is an
anchor tag for links, etc.
Examples:
<p>This is a paragraph.</p>
Attributes:
HTML tags can have attributes that provide additional information about an
element.
Example:
The <a> tag has an href attribute that specifies the URL of the link.
Images:
The <img> tag is used to embed images in a web page. It has a src attribute
that specifies the path to the image file.
                                        6
<img src="image.jpg" alt="A descriptive text for the image">
Lists:
HTML supports both ordered (<ol>) and unordered (<ul>) lists, as well as list
items (<li>).
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Forms:
Forms are used for user input. The <form> tag wraps form elements like text
inputs, buttons, checkboxes, etc.
<label for="username">Username:</label>
</form>
HTML Comments:
You can add comments in your HTML code using <!-- comment goes here -->.
 <p>This is a paragraph.</p>
                                       7
WHAT IS INTERNET:
Introduction :
   The web quickly grew to become the most popular way to access
    information on the internet.
   Together, the internet and the web have revolutionized the way we
    communicate, do business, and access information.
   They have made it possible for people all over the world to connect with
    each other instantly and have transformed many industries, from media
    and entertainment to education and healthcare.
The Internet:
                                     8
Application layer (highest) – concerned with the data(URL, type, etc.). This is
where HTTP, HTTPS, etc., comes in.
1. The World Wide Web: The Web is the only way to access information
through the Internet. It’s a system of Internet servers that support specially
formatted documents.
These documents are interlinked using hypertext links and are accessible
via the Internet.
Internet Web
                                       9
   The Internet is the network of The             Web   is   a   way    to    access
    networks     and     the      network information through the Internet.
    allows to exchange of data
    between      two         or      more
    computers.
   It is also known as the Network The Web is a model for sharing
    of Networks.                            information using the Internet.
   The    Internet    is    a    way   of The protocol used by the web is
    transporting            information HTTP.
    between devices.
   Accessible in a variety of ways         The Web is accessed by the Web
                                            Browser.
                                          10
         infrastructure      for   the    Web, and     accessing   information   and
         email,     and       other      online resources on the Internet
         services
        No single creator                      Creator Tim Berners-Lee
   A URL consists of a protocol, domain name, and path (which includes the
    specific subfolder structure where a page is located) like-
protocol://WebSiteName.topLevelDomain/path
WEB BROWSER:
       HTML is responsible for telling a Web browser how text and other
    objects in a Web document should appear.
                                              11
   Hypertext Transfer Protocol (HTTP) is define how browsers should
    request Web pages and how Web servers should respond to those
    requests.
   During the parsing stage, the browser reads the markup in the document,
    breaks it down into components, and builds a document object model
    (DOM).
   When the DOM tree has been constructed, and any CSS style sheets have
    been loaded and parsed, the browser starts the rendering stage. Each
    node in the DOM tree will be rendered and displayed in the browser.
Web Browser
   The first web browser was invented in 1990 by Sir Tim Berners Lee. It
    was called World Wide Web and was later renamed as Nexus.
   After that the world's first popular browser Mosaic innovated by Marc
    Andreessen in 1993, which made the World Wide Web system easy to use
    and more accessible to the average person.
   Over the years many other browsers were developed , but Microsoft
    Internet Explorer , Mozilla Firefox and Google's Chrome continue to
    dominate todays market
   All web activity begins on the client side , when a user starts his or her
    browser.
                                      12
   Each browser renders HTML a bit differently such as handles JavaScript,
    multimedia, style sheets, and other HTML add-ins differently.
   Web browsers were created specifically for the purpose of reading HTML
    instructions and displaying the resulting Web page.
   So When you work with HTML, you need to test your pages on as many
    different browsers as you can.
Web Page
   web page is a document available on world wide web. Web Pages are
    stored on web server and can be viewed using a web browser.
   A web page can cotain huge information including text, graphics, audio,
    video and hyper links. These hyper links are the link to other web pages.
   Static web pages are also known as flat or stationary web page. They are
    loaded on the client’s browser as exactly they are stored on the web
    server.
   Such web pages contain only static information. User can only read the
    information but can’t do any modification or interact with the
    information.
   Static web pages are created using only HTML. Static web pages are only
    used when the information is no more required to be modified.
                                      13
   Dynamic web page shows different information at different point of
    time.
Scripting Languages
 These scripts are interpreted not compiled and executed line by line.
Client-side Scripting
                                        14
Following table describes commonly used Client-Side scripting languages:
Server-side Scripting
Sever-side scripting acts as an interface for the client and also limit the user
access the resources on web server. It can also collects the user’s
characteristics in order to customize response.
                                            15
1         ASP         Active Server Pages (ASP)is server-side
                      script engine to create dynamic web
                      pages. It supports Component Object
                      Model (COM) which enables ASP web
                      sites to access functionality of libraries
                      such as DLL.
HTML BASICS:
                       16
   In this article, we will see the HTML Basics by understanding all the basic
    stuff of HTML coding.
   There are various tags that we must consider and include while starting
    to code in HTML.
   Below mentioned are the basic HTML tags that divide the whole
    document into various parts like head, body, etc.
<!DOCTYPE html>
 <html> : Every HTML code must be enclosed between basic HTML tags.
        <head>: The head tag comes next which contains all the header
         information of the web page or documents like the title of the page
         and other miscellaneous information.
        This information is enclosed within the head tag which opens with
         <head> and ends with </head>. The contents will of this tag will be
         explained in the later sections of the course.
                                         17
    <title>: We can mention the title of a web page using the <title> tag. This
    is header information and hence is mentioned within the header tags.
       The tag begins with <title> and ends with </title>
    <body>:
    Next step is the most important of all the tags we have learned so far.
     The body tag contains the actual body of the page which will be visible to
     all the users.
    This opens with <body> and ends with </body>.
    All content enclosed within this tag will be shown on the web page be it
     writings or images or audio or videos or even links.
    We will see later in the section how using various tags we may insert
     mentioned contents into our web pages.
Example:
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
</body>
                                          18
</html>
 It just shows the basic pattern of how to write the HTML code and will
name the title of the page as Geeks for Geeks. <! – – comment here – – > is
the comment tag in HTML and it doesn’t read the line present inside this tag.
HTML Headings:
    HTML provides us with six heading tags from <h1> to <h6>. Every tag
     displays the heading in a different style and font size.
Heading 1
Heading 2
Heading 3
Example:
This example illustrates the use of 6 heading tags from <h1> to <h6> in
HTML.
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
                                        19
<body>
<h1>Hello GeeksforGeeks</h1>
<h2>Hello GeeksforGeeks</h2>
<h3>Hello GeeksforGeeks</h3>
<h4>Hello GeeksforGeeks</h4>
<h5>Hello GeeksforGeeks</h5>
<h6>Hello GeeksforGeeks</h6>
</body>
</html>
Output:
Hello GeeksforGeeks
Hello GeeksforGeeks
Hello GeeksforGeeks
Hello GeeksforGeeks
HELLO GEEKSFORGEEKS
HELLO GEEKSFORGEEKS
HTML Headings
HTML Paragraph:
HTML Break:
                                       20
These tags are used for inserting a single line type break. It does not have
any closing tag. In HTML the break tag is written as <br>.
Example:
This example illustrates the use of the <p> tag for writing a paragraph
statement in HTML.
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
<h1>Hello GeeksforGeeks</h1>
</p>
</body>
</html>
Output:
Hello GeeksforGeeks
HTML Paragraph
                                      21
    HTML Horizontal Line: The <hr> tag is used to break the page into
     various parts, creating horizontal margins with help of a horizontal line
     running from the left to right-hand side of the page.
 This is also an empty tag and doesn’t take any additional statements.
Example:
This example illustrates the use of the <hr> tag for the horizontal line in
HTML.
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
<h1>Hello GeeksforGeeks</h1>
<p>
</p>
<hr>
<p>
                                       22
  </p>
<hr>
<p>
</p>
<hr>
</body>
</html>
Output:
Hello GeeksforGeeks
HTML Images:
                                      23
The image tag is used to insert an image into our web page. The source of
the image to be inserted is put inside the <img src=”source_of_image“> tag.
    If the image is in the same folder, then we can just write the name of the
     image and the format as the path.
Example:
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
    <img               src="https://media.geeksforgeeks.org/wp-content/cdn-
uploads/Geek_logi_-low_res.png">
</body>
</html>
Output:
Title Tag: The title tag <title> specifies the HTML page title, which is shown
in the browser’s title bar.
Body Tag: The body tag <body> is where you insert your web page’s content.
Paragraph Tag:
Heading Tag :
The HTML heading tag is used to define the heading of the HTML document.
The <h1> tag defines the most important tag, and <h6> defines the least.
Formatting Tags
Emphasis tag: The HTML <em> tag is used to emphasize the particular text
in a paragraph.
Bold Tag: The <b> tag is used to make the text bold.
Italic Tag: The <i> tag is used to make the text italic.
Underline Tag: The <u> tag is used to set the text underline.
Link Tag: The <a> tag links one page to another page. The href attribute is
used to define
List Tag: The <li> tag is used if you want to enter the contents in the listed
order. There are two types of lists.
                                        25
Image Tag :
The <img> tag is used to embed an image in an HTML document. You need
to specify the source of the image inside the tag.
The table row (<tr>) tag is used to make the rows in the table, and the table
data (<td>) tag is used to enter the data in the table.
The style (<style>) tag is used to add methods to the content by typing the
code in the HTML file itself.
                                    UNIT 2
                                       26
           TAGS FOR DOCUMENT STRUCTURE IN HTML:
 HTML (HyperText Markup Language) files are, basically, just simple text
    files that you could create in any text editor.
 Any variation from this structure will cause many web browsers to show
    the content incorrectly or not at all.
 Also, all HTML documents must have a suffix of “html” for the HTML
    code to be viewed correctly by a web browser.
   The people who determine what this stucture is, is the World Wide Web
    Consortium (W3C).
   Nonetheless, it is best when you are creating a web page to follow the
    current web standards.
   This will ensure your site is viewable in as many browsers as possible. All
    HTML instruction on this ETS site follows the W3C standards.
Example
<!DOCTYPE HTML>
                                        27
<html>
<head>
<meta charset=utf-8">
<style>
p {text-align:center;}
</style>
</head>
<body>
<h1>This is a header</h1>
</body>
</html>
   In the above example, you can see the use of tags which are an essential
    part of an HTML document.
   An HTML tag consists of a left angle bracket (<), a tag name (such as "h1")
    and a right angle bracket (>). Tags are usually paired so that you have a
    tag at the beginning and the end of a section of the document (<h1> and
    </h1> for example.)
   All end tags look identical to the beginning tag except a slash (/)
    precedes the tag name within the brackets.
                                      28
   A pair of tags delineates where the tag's effect should begin and end on
    the page. The current web standard from W3C suggests that all tag
    names be lowercase.
 Attributes
   Attributes are specific to each tag, although there are many similarities.
    Some tags must have an attribute to function properly.
Closing Tags
   Also, all nested HTML tags must be ended in the reverse order they were
    created.
   All of the tags must open and close within each other like a set of
    Russian nesting dolls.
                                       29
Tag Placement
   Within a web page, some HTML tags are required for the page to be
    displayed correctly.
   These tags are <html>, <head>, <title> and <body>. The <html> tags
    must begin and end the document and the <head> tags must appear
    before the <body> tags. Also, the <title> tags must be within the <head>
    tags.
   <html> This tag and its end tag must be the first tag (after the Doctype)
    and the last tag in your document.
   It tells the browser that everything within these tags should be viewed as
    HTML-coded information and should be parsed accordingly by the
    browser.
   <head> This tag and its end tag sets apart the section of your document
    that will not be visible on your web page but helps the browser in
    working with the document.
   Many different tags can be placed within the <head> tags, but in our
    example above we only have the required tag, <title>.
   For example, this web page's <title> is "ETS - HTML Basics - Structure" as
    you can see by looking at the titlebar of this browser window.
                                       30
   This title is also displayed in a browser's history and bookmarks, so it is
    best to be descriptive with this tag so that it will understandable out of
    context.
   <body> This tag contains all elements of your document that will appear
    within a browser's window. This is the content of your document and is
    where the majority of HTML tags will be placed.
   There are many more HTML tags that you will use to create your web
    page, but these four must always be within your document and ordered
    in the manner shown in the example above.
HTML - Blocks
   All the HTML elements can be categorized into two categories (a) Block
    Level Elements (b)Inline Elements.
Block Elements
Block elements appear on the screen as if they have a line break before and
after them. For example, the <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ul>,
<ol>, <dl>, <pre>, <hr />, <blockquote>, and <address> elements are all
block level elements.
They all start on their own new line, and anything that follows them appears
on its own new line.
Inline Elements
Inline elements, on the other hand, can appear within sentences and do not
have to appear on a new line of their own. The <b>, <i>, <u>, <em>,
<strong>, <sup>, <sub>, <big>, <small>, <li>, <ins>, <del>, <code>, <cite>,
<dfn>, <kbd>, and <var> elements are all inline elements.
                                         31
Grouping HTML Elements
There are two important tags which we use very frequently to group various
other HTML tags (i) <div> tag and (ii) <span> tag
   This is the very important block level tag which plays a big role in
    grouping various other HTML tags and applying CSS on group of
    elements.
   Even now <div> tag can be used to create webpage layout where we
    define different parts (Left, Right, Top etc.) of the page using <div> tag.
   This tag does not provide any visual change on the block but this has
    more meaning when it is used with CSS.
Example
Example program
<!DOCTYPE html>
                                       32
<html>
<head>
</head>
<body>
<ul>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</div>
                                     33
       <p>Following is a list of fruits</p>
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Mango</li>
<li>Strawberry</li>
</ul>
</div>
</body>
</html>
      Beetroot
      Ginger
      Potato
      Radish
      Apple
                                        34
        Banana
        Mango
        Strawberry
    The HTML <span> is an inline element and it can be used to group inline-
     elements in an HTML document.
    This tag also does not provide any visual change on the block but has
     more meaning when it is used with CSS.
    The difference between the <span> tag and the <div> tag is that the
     <span> tag is used with inline elements whereas the <div> tag is used
     with block-level elements.
Example
Example program
<!DOCTYPE html>
<html>
<head>
                                      35
     <title>HTML span Tag</title>
</head>
<body>
</body>
</html>
HTML Paragraphs
HTML Paragraphs
Example
<p>This is a paragraph.</p>
This is a paragraph.
                                      36
This is a paragraph.
This is a paragraph.
HTML Display
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the display by adding extra spaces or extra
lines in your HTML code.
The browser will automatically remove any extra spaces and lines when the
page is displayed:
Example
<p>
This paragraph
ignores it.
</p>
<p>
                                      37
This paragraph contains a lot of spaces in the source code but the browser
ignores it.</p>
Output:
This paragraph contains a lot of lines in the source code, but the browser
ignores it.
This paragraph contains a lot of spaces in the source code, but the browser
ignores it.
The <hr> tag defines a thematic break in an HTML page, and is most often
displayed as a horizontal rule.
Example
<hr>
                                      38
<hr>
The <hr> tag is an empty tag, which means that it has no end tag.
Output:
This is heading 1
This is heading 2
This is heading 2
Use <br> if you want a line break (a new line) without starting a new
paragraph:
Example
The <br> tag is an empty tag, which means that it has no end tag.
                                     39
Output:
This is
a paragraph
with line breaks.
Example
<p>
</p>
Output:
My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies
over the ocean. Oh, bring back my Bonnie to me.
                                      40
Solution - The HTML <pre> Element
Example
<pre>
</pre>
Ouput:
                                      41
 Oh, bring back my Bonnie to me.
In HTML, you can use various style elements to format text. Here's a detailed
explanation of some of the commonly used style elements:
The <strong> element is similar to <b>, but it carries more semantic weight,
indicating that the text is of strong importance.
Example:
Output:
The <em> element is similar to <i>, but it carries more semantic weight,
indicating that the text should be emphasized.
Example:
                                      42
<p>This is <em>emphasized text</em>.</p>
Output:
Font (<font>):
The <font> element allows you to set various text properties such as color,
size, and face. However, using CSS is recommended for styling instead of the
deprecated <font> tag.
Example:
Output:
Small (<small>):
The <small> element is used to decrease the font size, indicating that the
text is smaller than the normal text.
Example:
Output:
                                        43
The <strike> element is used to draw a horizontal line through the text,
indicating that it is no longer relevant.
Example:
Output:
Big (<big>):
The <big> element is used to increase the font size, indicating that the text is
larger than the normal text.
Example:
Output:
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
                                          44
 <title>Text Styling Example</title>
</head>
<body>
</body>
</html>
Output:
                                       45
This is bold text.
Remember that using CSS for styling is generally recommended over these
HTML tags for better separation of concerns.
                                          46
                             UNIT 3
LIST
HTML lists allow web developers to group a set of related items in lists.
Example
Item
Item
Item
Item
First item
Second item
Third item
Fourth item
OUTPUT:
Coffee
Tea
Milk
Coffee
                                      47
Tea
Milk
An unordered list starts with the <ul> tag. Each list item starts with the <li>
tag.
The list items will be marked with bullets (small black circles) by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
OUTPUT:
Coffee
Tea
Milk
UNORDEREED LIST:
                                       48
Unordered HTML List
An unordered list starts with the <ul> tag. Each list item starts with the <li>
tag.
The list items will be marked with bullets (small black circles) by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
OUTPUT:
Coffee
Tea
Milk
The CSS list-style-type property is used to define the style of the list item
marker. It can have one of the following values:
Square.
None.
Example - Disc
<ul style="list-style-type:disc;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
OUTPUT:
       Coffee
       Tea
       Milk
Example - Circle
<ul style="list-style-type:circle;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
                                         50
</ul>
OUTPUT:
Coffee
Tea
Milk
Example - Square
<ul style="list-style-type:square;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
OUTPUT:
Coffee
Tea
Milk
Example - None
<ul style="list-style-type:none;">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
                                       51
OUTPUT:
Coffee
Tea
Milk
Example
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
OUTPUT:
A Nested List
                                          52
Coffee
Tea
Black tea
Green tea
Milk
Note: A list item (<li>) can contain a new list, and other HTML elements, like
images and links, etc.
Example
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333333;
                                      53
li {
float: left;
li a {
display: block;
color: white;
text-align: center;
padding: 16px;
text-decoration: none;
li a:hover {
background-color: #111111;
</style>
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
                                        54
 <li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
OUTPUT:
Navigation Menu
Home
News
Contact
About
ORDERDER LIST:
The HTML <ol> tag defines an ordered list. An ordered list can be numerical
or alphabetical.
                                     55
An ordered list starts with the <ol> tag. Each list item starts with the <li>
tag.
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT:
Coffee
Tea
Milk
The type attribute of the <ol> tag, defines the type of the list item marker:
Type Description
type="I" The list items will be numbered with uppercase roman numbers
                                       56
type="i"     The list items will be numbered with lowercase roman numbers
Numbers
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT
 Coffee
 Tea
 Milk
Uppercase Letters:
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT
A. Coffee
B. Tea
C. Milk
Lowercase Letters:
<ol type="a">
                                    57
     <li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT:
a. Coffee
b. Tea
c. Milk
<ol type="I">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT:
I. Coffee
II. Tea
III. Milk
<ol type="i">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
                           58
</ol>
OUTPUT:
i. Coffee
ii. Tea
iii. Milk
By default, an ordered list will start counting from 1. If you want to start
counting from a specified number, you can use the start attribute:
Example
<ol start="50">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
OUTPUT:
50. Coffee
51. Tea
52. Milk
Example
<ol>
                                          59
 <li>Coffee</li>
<li>Tea
<ol>
<li>Black tea</li>
<li>Green tea</li>
</ol>
</li>
<li>Milk</li>
</ol>
OUTPUT:
1. Coffee
2. Tea
1. Black tea
2. Green tea
3. Milk
Note: A list item (<li>) can contain a new list, and other HTML elements, like
images and links, etc.
Chapter Summary
                                      60
List items can contain other HTML elements
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
OUTPUT:
 Coffee
 Tea
 Milk
Tag Description
Syntax :
                                        61
The marquee element comes in pairs. It means that the tag has opening and
closing elements.
<marquee>
</marquee>
ATTRIBUTES:
                                    62
Methods
start (): This method is used to start the scrolling of the Marquee Tag.
stop (): This method is used to stop the scrolling of the Marquee Tag.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Marquee Tag</title>
<style>
.main {
text-align:center;
.marq {
padding-top:30px;
padding-bottom:30px;
.geek1 {
font-size:36px;
font-weight:bold;
color:white;
padding-bottom:10px;
</style>
                                       63
</head>
<body>
<div class="geek1">GeeksforGeeks</div>
</marquee>
</div>
</body>
</html>
GeeksforGeeks
HR AND BR TAGS:
Sure, let me provide you with a detailed explanation of the <hr> (horizontal
rule) and <br> (line break) tags in HTML, along with example programs and
their expected outputs.
The <hr> tag is used to create a thematic break or horizontal line in the
HTML document.
                                      64
It is often used to separate content into different sections.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Section 1</h2>
<hr>
<h2>Section 2</h2>
</body>
</html>
Output:
Section 1
                                       65
Section 2
The <br> tag is used to insert a line break within text. It forces the text
following it to start on a new line.
EXAMPLE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
Output:
                                       66
line break.
Images in HTML:
Example Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Example</title>
</head>
<body>
<h2>Displaying an Image</h2>
</body>
</html>
OUTPUT:
Displaying an Image
                                      67
These elements (<hr>, <br>, <img>) are simple but essential for structuring
and formatting content in HTML. Use them judiciously to improve the
readability and visual presentation of your web pages.
CREATING HYPERLINKS:
Links are found in nearly all web pages. Links allow users to click their way
from page to page.
When you move the mouse over a link, the mouse arrow will turn into a little
hand.
Note: A link does not have to be text. A link can be an image or any other
HTML element!
The most important attribute of the <a> element is the href attribute, which
indicates the link's destination.
The link text is the part that will be visible to the reader.
Clicking on the link text, will send the reader to the specified URL address.
Example
OUTPUT:
HTML Links
Visit W3Schools.com!
                                        69
An active link is underlined and red
Tip: Links can of course be styled with CSS, to get another look!
By default, the linked page will be displayed in the current browser window.
To change this, you must specify another target for the link.
Example
OUTPUT:
                                       70
Visit W3Schools!
Both examples above are using an absolute URL (a full web address) in the
href attribute.
A local link (a link to a page within the same website) is specified with a
relative URL (without the "https://www" part):
Example
<h2>Absolute URLs</h2>
<p><a href="https://www.w3.org/">W3C</a></p>
<p><a href="https://www.google.com/">Google</a></p>
<h2>Relative URLs</h2>
OUTPUT:
Absolute URLs
W3C
                                       71
Relative URLs
HTML Images
CSS Tutorial
To use an image as a link, just put the <img> tag inside the <a> tag:
Example
<a href="default.asp">
</a>
OUTPUT:
Image as a Link
Use mailto: inside the href attribute to create a link that opens the user's
email program (to let them send a new email):
Example
                                       72
OUTPUT:
To create a link that opens in the user's email program (to let them send a
new email), use mailto: inside the href attribute:
Send email
Button as a Link
To use an HTML button as a link, you have to add some JavaScript code.
Example
OUTPUT:
Button as a Links
HTML Tutorial
Link Titles
                                       73
The title attribute specifies extra information about an element. The
information is most often shown as a tooltip text when the mouse moves
over the element.
Example
OUTPUT:
Link Titles
Example
OUTPUT:
External Paths
HTML tutorial
                                        74
Chapter Summary
Use the target attribute to define where to open the linked document
Use the mailto: scheme inside the href attribute to create a link that opens
the user's email program
Tag Description
For a complete list of all available HTML tags, visit our HTML Tag Reference.
UNIT 4:
TABLES:
HTML Tables
HTML tables allow web developers to arrange data into rows and columns.
                                       75
A table in HTML consists of table cells inside rows and columns
EXAMPLE:
<!DOCTYPE html>
<html>
<style>
table, th, td {
</style>
<body>
<table style="width:100%">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
                                     76
 </tr>
<tr>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
</body>
</html>
OUTPUT:
           Alfreds
                            Maria Anders     Germany
           Futterkiste
Table Cells
Everything between <td> and </td> are the content of the table cell.
<!DOCTYPE html>
<html>
<style>
table, th, td {
</style>
<body>
<table style="width:100%">
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
                                     78
</body>
</html>
output:
Table Rows
Each table row starts with a <tr> and ends with a </tr> tag.
EXAMPLE:
<!DOCTYPE html>
<html>
<style>
table, th, td {
</style>
<body>
<table style="width:100%">
    <tr>
                                      79
  <td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
</body>
</html>
OUTPUT:
16 14 10
                                         80
Table Headers
Sometimes you want your cells to be table header cells. In those cases use
the <th> tag instead of the <td> tag:
EXAMPLE:
<!DOCTYPE html>
<html>
<style>
table, th, td {
</style>
<body>
<table style="width:100%">
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
                                        81
  <td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
</body>
</html>
OUTPUT:
16 14 10
                                    82
<table>    Defines a table
<caption
           Defines a table caption
>
Horizontal Alignment
The text-align property sets the horizontal alignment (like left, right, or
center) of the content in <th> or <td>.
By default, the content of <th> elements are center-aligned and the content
of <td> elements are left-aligned.
                                        83
      Firstname                  Lastname        Savings
EXAMPLE:
<!DOCTYPE html>
<html>
<head>
<style>
table, td, th {
table {
border-collapse: collapse;
width: 100%;
td {
text-align: center;
</style>
                                            84
</head>
<body>
<p>This property sets the horizontal alignment (like left, right, or center) of
the content in th or td.</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
<td>$100</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
<td>$150</td>
</tr>
<tr>
<td>Joe</td>
                                       85
  <td>Swanson</td>
<td>$300</td>
</tr>
<tr>
<td>Cleveland</td>
<td>Brown</td>
<td>$250</td>
</tr>
</table>
</body>
</html>
OUTPUT:
           Swanso
  Joe               $300
             n
                                       86
     nd
            Swanso
Joe                  $300
            n
EXAMPLE:
<!DOCTYPE html>
<html>
<head>
<style>
table, td, th {
table {
border-collapse: collapse;
width: 100%;
                                        87
}
th {
text-align: left;
</style>
</head>
<body>
<p>This property sets the horizontal alignment (like left, right, or center) of
the content in th or td.</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
<td>$100</td>
                                       88
 </tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
<td>$150</td>
</tr>
<tr>
<td>Joe</td>
<td>Swanson</td>
<td>$300</td>
</tr>
<tr>
<td>Cleveland</td>
<td>Brown</td>
<td>$250</td>
</tr>
</table>
</body>
</html>
OUTPUT:
                       89
The text-align Property
This property sets the horizontal alignment (like left, right, or center) of the
content in th or td.
Vertical Alignment
The vertical-align property sets the vertical alignment (like top, bottom, or
middle) of the content in <th> or <td>.
By default, the vertical alignment of the content in a table is middle (for both
<th> and <td> elements).
The following example sets the vertical text alignment to bottom for <td>
elements:
                                          90
Joe                    Swanson   $300
<!DOCTYPE html>
<html>
<head>
<style>
table, td, th {
table {
border-collapse: collapse;
width: 100%;
td {
height: 50px;
vertical-align: bottom;
</style>
</head>
<body>
                                 91
<h2>The vertical-align Property</h2>
<p>This property sets the vertical alignment (like top, bottom, or middle) of
the content in th or td.</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
<td>$100</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
<td>$150</td>
</tr>
<tr>
<td>Joe</td>
                                       92
  <td>Swanson</td>
<td>$300</td>
</tr>
<tr>
<td>Cleveland</td>
<td>Brown</td>
<td>$250</td>
</tr>
</table>
</body>
</html>
OUTPUT:
                                      93
Cleveland       Brown           $250
HTML tables can have cells that span over multiple rows and/or columns.
NAME
APR
 IL
                                    94
                    2022
FIESTA
Table - Colspan
To make a cell span over multiple columns, use the colspan attribute:
EXAMPLE:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border-collapse: collapse;
</style>
</head>
<body>
                                     95
<h2>Cell that spans two columns</h2>
<p>To make a cell span more than one column, use the colspan
attribute.</p>
<table style="width:100%">
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>43</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>57</td>
</tr>
</table>
</body>
</html>
OUTPUT:
                                   96
Cell that spans two columns
To make a cell span more than one column, use the colspan attribute.
Name Age
Jill Smith 43
Eve Jackson 57
Table - Rowspan
To make a cell span over multiple rows, use the rowspan attribute:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border-collapse: collapse;
</style>
</head>
<body>
                                            97
<p>To make a cell span more than one row, use the rowspan attribute.</p>
<table style="width:100%">
<tr>
<th>Name</th>
<td>Jill</td>
</tr>
<tr>
<th rowspan="2">Phone</th>
<td>555-1234</td>
</tr>
<tr>
<td>555-8745</td>
</tr>
</table>
</body>
</html>
OUTPUT:
Name Jill
Phone 555-1234
                                    98
            555-8745
HTML tables can adjust the padding inside the cells, and also the space
between the cells.
With padding
                                   With Spacing
           hello           hello             hello
Cell Padding
Cell padding is the space between the cell edges and the cell content.
                                        99
By default the padding is set to 0.
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border-collapse: collapse;
th, td {
padding: 15px;
</style>
</head>
<body>
<h2>Cellpadding</h2>
<p>Cell padding specifies the space between the cell content and its
borders.</p>
<table style="width:100%">
<tr>
<th>Firstname</th>
                                      100
  <th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
</body>
</html>
                                  101
OUTPUT:
Cell padding
Cell padding specifies the space between the cell content and its borders.
Jill Smith 50
Eve Jackson 94
John Doe 80
Cell Spacing
To change the space between table cells, use the CSS border-spacing
property on the table element:
Example
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
}
                                       102
table {
border-spacing: 30px;
</style>
</head>
<body>
<h2>Cellspacing</h2>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
                                   103
   <td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
</body>
</html>
OUTPUT:
Cell spacing
Change the space between the cells with the border-spacing property.
Jill Smith 50
Eve Jackson 94
John Doe 80
                                       104
                                   UNIT 5
FRAMES
HTML Frames are used to divide the web browser window into multiple
sections where each section can be loaded separately.
Creating Frames:
Instead of using body tag, use frameset tag in HTML to use frames in web
browser. But this Tag is deprecated in HTML.
The frameset tag is used to define how to divide the browser. Each frame is
indicated by frame tag and it basically defines which HTML document shall
open into the frame.
To define the horizontal frames use row attribute of frame tag in HTML
document and to define the vertical frames use col attribute of frame tag in
HTML document.
Example:
<!DOCTYPE html>
<html>
<head>
                                     105
  </head>
"C:/Users/dharam/Desktop/attr1.png" />
"C:/Users/dharam/Desktop/gradient3.png" />
"C:/Users/dharam/Desktop/col_last.png" />
<noframes>
</noframes>
</frameset>
</html>
OUTPUT:
                                    106
<!DOCTYPE html>
<html>
<head>
</head>
"C:/Users/dharam/Desktop/attr1.png" />
       <framename="main"src=       "C:/Users/dharam/Desktop/gradient3.png"
/>
"C:/Users/dharam/Desktop/col_last.png" />
<noframes>
                                         107
       <body>The browser you are working does
</noframes>
</frameset>
</html>
Output:
The above example basically used to create three vertical frames: left, center
and right using col attribute of frameset tag.
frame tag
cols: The cols attribute is used to create vertical frames in web browser. This
attribute is basically used to define the no of columns and its size inside the
frameset tag.
The size or width of the column is set in the frameset in the following ways:
Example:
Example:
                                      108
Example:
In the above example * will take the remaining percentage for creating
vertical frame.
Rows: The rows attribute is used to create horizontal frames in web browser.
This attribute is used to define no of rows and its size inside the frameset
tag.
The size of rows or height of each row use the following ways:
Example:
Example:
Example:
In the above example * will take the remaining percentage for creating
horizontal frame.
Border: This attribute of frameset tag defines the width of border of each
frames in pixels. Zero value is used for no border.
Example:
framespacing:
Example:
<framespacing="20">
Name:
This attribute is used to give names to the frame. It differentiate one frame
from another. It is also used to indicate which frame a document should
loaded into.
Example:
<framename="main"src="C:/Users/dharam/Desktop/gradient3.png" />
<framename="bottom"src="C:/Users/dharam/Desktop/col_last.png" />
Here we use three frames with names as left center and right.
                                     110
src: This attribute in frame tag is basically used to define the source file that
should be loaded into the frame.The value of src can be any url.
Example:
In the above example name of frame is left and source file will be loaded
from “/html/left.htm” in frame.
MARGINWIDTH:
This attribute in frame tag is used to specify width of the spaces in pixels
between the border and contents of left and right frame.
Example:
<frame marginwidth="20">
MARGINHEIGHT:
This attribute in frame tag is used to specify height of the spaces in pixels
between the border and contents of top and bottom frame.
Example:
<frame marginheight="20">
SCROLLBAR:
Example:
<frame scrollbar="no">
                                       111
Advantages:
 It allows the user to view multiple documents within a single Web page.
   The older browsers that do not support frames can be addressed using
    the tag.
Disadvantages:
 The browser’s back button might not work as the user hopes.
 The use of too many frames can put a high workload on the server.
Supported Browser: The browser supported by <frame> tag are listed below:
 Google Chrome
 Internet Explorer
 Firefox
 Opera
 Safari
                                      112
CSS is the foundation of webpages, is used for webpage development by
styling websites and web apps.
TARGETLINKS IN HTML”;
The HTML <link> target Attribute is used to specify the window or a frame
where the linked document is loaded. It is not supported by HTML 5.
Syntax:
<link target="_blank|_self|_parent|_top|framename">
Attribute Values:
_self: It is the default value. It opens the linked document in the same frame.
_top: It opens the linked document in the full body of the window.
FRAMENAME:
Example:
<!DOCTYPE html>
<html>
<head>
<title>
                                      113
    HTML link target Attribute
</title>
</head>
<body>
<center>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h2>
</h2>
</center>
</body>
</html>
Output:
                                        114
Supported Browsers:
The <noframes> tag is the backup for those browsers that does not support
frames. This tag can contains all the element that can be placed in <body>
tag. It is used to create link with the non-frame set version of any website
where you want to display a message to the user. This <noframes> tag is not
supported in HTML5.
Syntax:
EXAMPLE:
<html>
<head>
<title>noframes tag</title>
<style>
frame {
text-align: center;
</style>
</head>
                                        115
<!-- frameset attribute starts here -->
<noframes>
</noframes>
</frameset>
</html>
OUTPUT:
                                          116
Supported Browsers:
 Google Chrome
 Internet Explorer
 Firefox
 Safari
 Opera
HTML FORMS:
An HTML form is used to collect user input. The user input is most often
sent to a server for processing.
HTML Forms
                                   117
If you click the "Submit" button, the form-data will be sent to a page called
"/action_page.php".
OUTPUT:
HTML Forms
First name:
 John
Last name:
 Doe
Submit
If you click the "Submit" button, the form-data will be sent to a page called
"/action_page.php".
All the different form elements are covered in this chapter: HTML Form
Elements.
                                      118
         Type                     Description
All the different input types are covered in this chapter: HTML Input Types.
TEXTAREA IN HTML:
                                      119
The <textarea> element is often used in a form, to collect user inputs like
comments or reviews.
A text area can hold an unlimited number of characters, and the text renders
in a fixed-width font (usually Courier).
The size of a text area is specified by the cols and rows attributes (or with
CSS).
The name attribute is needed to reference the form data after the form is
submitted (if you omit the name attribute, no data from the text area will be
submitted).
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
                                      120
 <p><label for="w3review">Review of W3Schools:</label></p>
<br>
</form>
<p>Click the "Submit" button and the form-data will be sent to a page on the
</body>
</html>
OUTPUT:
Review of W3Schools:
Submit
                                       121
Click the "Submit" button and the form-data will be sent to a page on the
server called "action_page.php".
SELECT IN HTML:
The <select> element is most often used in a form, to collect user input.
The name attribute is needed to reference the form data after the form is
submitted (if you omit the name attribute, no data from the drop-down list
will be submitted).
The <option> tags inside the <select> element define the available options in
the drop-down list.
Tip: Always add the <label> tag for best accessibility practices!
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
                                      122
<form action="/action_page.php">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<br><br>
</form>
<p>Click the "Submit" button and the form-data will be sent to a page on the
</body>
</html>
OUTPUT:
Choose a car:
Submit
 Click the "Submit" button and the form-data will be sent to a page on the
 server called "action_page.php".
Browser Support
Element
Attributes
                                       124
                               disabled
Global Attributes
Event Attributes
OPTIONS IN HTML
                                     125
Definition and Usage
Note: The <option> tag can be used without any attributes, but you usually
need the value attribute, which indicates what is sent to the server on form
submission.
Tip: If you have a long list of options, you can group related options within
the <optgroup> tag.
Element
Attributes
Global Attributes
More Examples
Example
<datalist id="browsers">
<option value="Edge">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
                                     127
 <option value="Safari">
</datalist>
Example
<select id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
128