Unit-2_html
Unit-2_html
HTML
HTML elements label pieces of content such as "this is a heading", "this is a paragraph",
"this is a link", etc.
An HTML document is structured using a set of nested tags. Each tag is enclosed
within <…> angle brackets and acts as a container for content or other HTML tags.
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
</body>
</html>
Note: These are the essential elements for a basic HTML document: <!DOCTYPE
html>, <html>, <head>, <title>, </head>, <body>, </body>, </html>
1
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
DOCTYPE Declaration
<!DOCTYPE html>
The <!DOCTYPE html> declaration informs the web browser about the HTML version
being used. The latest version is HTML5. But if this changes in the future (maybe 10
years down the line), the doctype declaration will be helpful!
<html>
The <html> tag is the root element that encapsulates all the content on the page.
</html>
Head Section
<head>
The <head> tag contains metadata and links to external resources like CSS and
JavaScript files.
</head>
Title Tag
<title>Document</title>
The <title> tag sets the title of the web page, which is displayed in the browser's title
bar or tab.
Body Tag
<body>
The <body> tag contains the visible content of the web page. This is where text, images,
and other elements go.
</body>
2
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The </body> tag marks the end of the visible content of the web page.
Summary
The <!DOCTYPE html> tag specifies that the document is an HTML5 document.
The <head> section contains metadata and the title of the webpage, which appears in
the browser's title bar.
The <body> section contains the content that will be displayed on the webpage.
The h1 and p are two types of tags. We will learn about more tags in the later section
3
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
<p>This is a paragraph</p>
</body>
</html>
Copy
Below is an image showing how this HTML document will be rendered in a web browser:
In the browser, the title bar will display the content from the <head> section, specifically
the <title> tag. The main area of the browser window (usually a white background) will display
the content inside the <body> tag.
4
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML Formatting
HTML Formatting is a process of formatting text for better look and feel.
HTML provides us ability to format text without using CSS. There are many formatting
tags in HTML.
These tags are used to make text bold, italicized, or underlined
In HTML the formatting tags are divided into two categories:
o Physical tag: These tags are used to provide the visual appearance to the text.
o Logical tag: These tags are used to add some logical or semantic value to the text.
NOTE: There are some physical and logical tags which may give same visual appearance, but
they will be different in semantics.
<b> This is a physical tag, which is used to bold the text written between it.
<strong> This is a logical tag, which tells the browser that the text is important.
<tt> This tag is used to appear a text in teletype. (not supported in HTML5)
<big> This tag is used to increase the font size by one conventional unit.
<small> This tag is used to decrease the font size by one unit from base font size.
5
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
1) Bold Text
Example
<!DOCTYPE html>
<html>
<head>
<title>formatting elements</title>
</head>
<body>
</body>
</html>
2) Italic Text
6
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<!DOCTYPE html>
<html>
<head>
<title>formatting elements</title>
</head>
<body>
</body>
</html>
If we want to mark or highlight a text, you should write the content within
<mark>.........</mark>.
<!DOCTYPE>
<html>
<body>
<h2> I want to put a <mark> Mark</mark> on your face</h2>
</body>
</html>
4) Underlined Text
<!DOCTYPE>
<html>
<body>
<p> <u>Write Your First Paragraph in underlined text.</u></p>
</body>
</html>
7
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
5) Strike Text
<!DOCTYPE>
<html>
<body>
<p> <strike>Write Your First Paragraph with strikethrough</strike>.</p>
</body>
</html>
6) Monospaced Font
If we want that each letter has the same width then you should write the content within
<tt>.............</tt> element.
Note: We know that most of the fonts are known as variable-width fonts because different
letters have different width. (for example: 'w' is wider than 'i'). Monospaced Font provides
similar space among every letter.
<!DOCTYPE>
<html>
<body>
<p>Hello <tt>Write Your First Paragraph in monospaced font.</tt></p>
</body>
</html>
7) Superscript Text
<!DOCTYPE>
<html>
<body>
<p>Hello <sup>Write Your First Paragraph in superscript.</sup></p>
</body>
</html>
Output:
8
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
8) Subscript Text
<!DOCTYPE>
<html>
<body>
<p>Hello <sub>Write Your First Paragraph in subscript.</sub></p>
</body>
</html>
Output:
9) Deleted Text
<!DOCTYPE>
<html>
<body>
<p>Hello <del>Delete your first paragraph.</del></p>
</body>
</html>
Output:
Hello
Output:
9
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
11) Larger Text
If you want to put your font size larger than the rest of the text then put the content
within <big>.........</big>. It increase one font size larger than the previous one.
<!DOCTYPE>
<html>
<body>
<p>Hello <big>Write the paragraph in larger font.</big></p>
</body>
</html>
Output:
If you want to put your font size smaller than the rest of the text then put the content
within <small>.........</small>tag. It reduces one font size than the previous one.
<!DOCTYPE>
<html>
<body>
<p>Hello <small>Write the paragraph in smaller font.</small></p>
</body>
</html>
Output:
HTML Table
HTML table tag is used to display data in tabular form (row * column). There can be
many columns in a row.
We can create a table to display data in tabular form, using <table> element, with the
help of <tr> , <td>, and <th> elements.
In Each table, table row is defined by <tr> tag, table header is defined by <th>, and
table data is defined by <td> tags.
HTML tables are used to manage the layout of the page e.g. header section, navigation
bar, body content, footer section etc. But it is recommended to use div tag over table to
manage the layout of the page .
10
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Tag Description
<col> It is used with <colgroup> element to specify column properties for each
column.
Let's see the example of HTML table tag. It output is shown above.
<table>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
<tr><td>James</td><td>William</td><td>80</td></tr>
<tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
<tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
</table>
Sonoo Jaiswal 60
11
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
James William 80
Swati Sironi 82
Chetna Singh 72
In the above html table, there are 5 rows and 3 columns = 5 * 3 = 15 values.
We can use border attribute of table tag in HTML to specify border. But it is not
recommended now.
<table border="1">
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
<tr><td>James</td><td>William</td><td>80</td></tr>
<tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
<tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
</table>
12
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Sonoo Jaiswal 60
James William 80
Swati Sironi 82
Chetna Singh 72
<style>
table, th, td {
</style>
We can collapse all the borders in one border by border-collapse property. It will
collapse the border into one.
<style>
table, th, td {
border-collapse: collapse;
</style>
13
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Output:
Sonoo Jaiswal 60
James William 80
Swati Sironi 82
Chetna Singh 72
You can specify padding for table header and table data by two ways:
The cellpadding attribute of HTML table tag is obselete now. It is recommended to use CSS.
So let's see the code of CSS.
1. <style>
2. table, th, td {
4. border-collapse: collapse;
5. }
6. th, td {
7. padding: 10px;
8. }
9. </style>
Output:
14
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Name Last Name Marks
Sonoo Jaiswal 60
James William 80
Swati Sironi 82
Chetna Singh 72
We can specify the HTML table width using the CSS width property. It can be specify
in pixels or percentage.
We can adjust our table width as per our requirement.
table{
width: 100%;
Example:
<!DOCTYPE html>
<html>
<head>
<title>table</title>
<style>
table{
border-collapse: collapse;
width: 100%;
}
th,td{
border: 2px solid green;
padding: 15px;
15
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
}
</style>
</head>
<body>
<table>
<tr>
<th>1 header</th>
<th>1 header</th>
<th>1 header</th>
</tr>
<tr>
<td>1data</td>
<td>1data</td>
<td>1data</td>
</tr>
<tr>
<td>2 data</td>
<td>2 data</td>
<td>2 data</td>
</tr>
<tr>
<td>3 data</td>
<td>3 data</td>
<td>3 data</td>
</tr>
</table>
</body>
</html>
Test it Now
Output:
16
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML Table with colspan
If we want to make a cell span more than one column, we can use the colspan attribute.
It will divide one cell/row into multiple columns, and the number of columns depend
on the value of colspan attribute.
CSS code:
<style>
table, th, td {
border-collapse: collapse;
th, td {
padding: 5px;
</style>
HTML code:
<table style="width:100%">
<tr>
<th>Name</th>
</tr>
<tr>
<td>Ajeet Maurya</td>
<td>7503520801</td>
<td>9555879135</td>
</tr>
17
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
</table>
Output:
If we want to make a cell span more than one row, we can use the rowspan attribute.
It will divide a cell into multiple rows. The number of divided rows will depend on
rowspan values.
CSS code:
<style>
table, th, td {
border-collapse: collapse;
th, td {
padding: 10px;
</style>
HTML code:
<table>
<tr><th>Name</th><td>Ajeet Maurya</td></tr>
<tr><td>9555879135</td></tr>
18
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
</table>
Output:
7503520801
Mobile No.
9555879135
<table>
<caption>Student Records</caption>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Vimal</td><td>Jaiswal</td><td>70</td></tr>
<tr><td>Mike</td><td>Warn</td><td>60</td></tr>
<tr><td>Shane</td><td>Warn</td><td>42</td></tr>
<tr><td>Jai</td><td>Malhotra</td><td>62</td></tr>
</table>
CSS code:
<style>
table, th, td {
19
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
border: 1px solid black;
border-collapse: collapse;
th, td {
padding: 10px;
table#alter tr:nth-child(even) {
background-color: #eee;
table#alter tr:nth-child(odd) {
background-color: #fff;
table#alter th {
color: white;
background-color: gray;
</style>
Output:
20
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML Links Hyperlinks
HTML links, or hyperlinks, connect web pages and are created using the `<a>` tag with
the `href` attribute.
They enable users to navigate between pages or resources.
Links can be text, images, or other elements, enhancing web navigation and
interactivity. Users can click on links to navigate between different pages or resources.
Note: A hyperlink can be represented by an image or any other HTML element, not just text.
Syntax
Target Attribute
Attribute Description
Opens the linked document in the same frame or window as the link. (Default
_self
behavior)
_top Opens the linked document in the full body of the window.
21
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<!DOCTYPE html>
<html>
<head>
<title>HTML Links</title>
</head>
<body>
<a href="[Link]
GeeksforGeeks
</a>
</body>
</html>
In this example we demonstrates the use of target attributes in links. Each link opens in a
different context: _blank opens in a new window or tab, _self in the same frame, _parent in the
parent frame, _top in the full window body, and framename in a specified frame.
22
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
If you set the target attribute to
"_blank", the link will open in a new
browser window or tab.
</p>
<a href="[Link]
target="_blank">
GeeksforGeeks
</a>
<p>
If you set the target attribute to
"_self", the link will open in the
same window or tab.
</p>
<a href="[Link]
target="_self">
GeeksforGeeks
</a>
<p>
If you set the target attribute to
"_top", the link will open in the full
body of the window.
</p>
<a href="[Link]
target="_top">
GeeksforGeeks
</a>
<p>
If you set the target attribute to
"_parent", the link will open in the
parent frame.
</p>
<a href="[Link]
target="_parent">
GeeksforGeeks
</a>
</body>
</html>
HTML <meta> tag is used to represent the metadata about the HTML document. It
specifies page description, keywords, copyright, language, author of the documents,
etc.
23
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The metadata does not display on the webpage, but it is used by search engines,
browsers and other web services which scan the site or webpage to know about the
webpage.
With the help of meta tag, you can experiment and preview that how your webpage will
render on the browser.
The <meta> tag is placed within the <head> tag, and it can be used more than one times
in a document.
Syntax:
<meta charset="utf-8">
Display None
Following are some specific syntaxes of meta tag which shows the different uses of meta Tag.
1. <meta charset="utf-8">
It defines the character encoding. The value of charset is "utf-8" which means it will
support to display any language.
It defines the website description which is useful to provide relevant search performed
by search engines.
It specifies the author of the page. It is useful to extract author information by Content
management system automatically.
24
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
It specifies to provide instruction to the browser to automatically refresh the content
after every 50sec (or any given time).
In the above example we have set a URL with content so it will automatically redirect
to the given page after the provided time.
It specifies the viewport to control the page dimension and scaling so that our website
looks good on all devices. If this tag is present, it indicates that this page is mobile
device supported.
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>This example shows the use of meta tag within an HTML document</p>
</body>
</html>
25
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Attribute:
content text It contains the value of the attribute "name" and "http-
equiv" in an HTML document, depending on context.
o refresh
o author
o description
o generator
o keywords
HTML Form
An HTML form is a section of a document which contains controls such as text fields,
password fields, checkboxes, radio buttons, submit button, menus etc.
An HTML form facilitates the user to enter data that is to be sent to the server for
processing such as name, email address, password, phone number, etc. .
HTML forms are required if we want to collect some data from the site visitor.
For example: If a user want to purchase some items on internet, he/she must fill the
form such as shipping address and credit/debit card details so that item can be sent to
the given address.
26
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML Form Syntax
3. </form>
Tag Description
Tag Description
27
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The HTML <form> element provide a document section to take input from user. It
provides various interactive controls for submitting information to web server such as
text field, text area, password field, etc.
Note: The <form> element does not itself create a form but it is container to contain all required
form elements, such as <input>, <label>, etc.
Syntax:
1. <form>
2. //Form elements
3. </form>
The HTML <input> element is fundamental form element. It is used to create form
fields, to take input from user. We can apply different input filed to gather different
information form user. Following is the example to show the simple text input.
Example:
<body>
<form>
</form>
</body>
Output:
28
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The type="text" attribute of input tag creates textfield control also known as single line
textfield control. The name attribute is optional, but it is required for the server side
component such as JSP, ASP, PHP etc.
<form>
</form>
Output:
Note: If we will omit 'name' attribute then the text filed input will not be submitted to server.
The <textarea> tag in HTML is used to insert multiple-line text in a form. The size of
<textarea> can be specify either using "rows" or "cols" attribute or by CSS.
Example:
<!DOCTYPE html>
<html>
<head>
29
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<title>Form in HTML</title>
</head>
<body>
<form>
</form>
</body>
</html>
Output:
NOTE: It is good to use <label> tag with form, although it is optional but if you will use it,
then it will provide a focus when you tap or click on label tag. It is more worthy with
touchscreens.
<form>
30
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<input type="text" id="firstname" name="firstname"/> <br/>
</form>
Output:
<form>
</form>
Output:
31
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The email field in new in HTML 5. It validates the text for correct email address. You
must use @ and . in this field.
<form>
</form>
Note: If we will not enter the correct email, it will display error like:
The radio button is used to select one option from multiple options. It is used for
selection of gender, quiz questions etc.
If we use one name for all the radio buttons, only one radio button can be selected at a
time.
Using radio buttons for multiple options, you can only choose a single option at a time.
32
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<form>
</form>
Checkbox Control
The checkbox control is used to check multiple options from given checkboxes.
<form>
Hobby:<br>
<label for="hockey">Hockey</label>
</form>
Note: These are similar to radio button except it can choose multiple options at a time and radio
button can select one button at a time, and its display.
Output:
33
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML <input type="submit"> are used to add a submit button on web page. When
user clicks on submit button, then form get submit to the server.
Syntax:
Example:
<form>
</form>
Output:
34
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
The <fieldset> element in HTML is used to group the related information of a form.
This element is used with <legend> element which provide caption for the grouped
elements.
Example:
<form>
<fieldset>
<legend>User Information:</legend>
</fieldset>
</form>
35
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
Output:
<!DOCTYPE html>
<html>
<head>
<title>Form in HTML</title>
</head>
<body>
<h2>Registration form</h2>
<form>
<fieldset>
36
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
<br><label>Enter your gender</label><br>
<textarea></textarea><br>
</fieldset>
</form>
</body>
</html>
Output:
The HTML media attribute is employed to specify the media or device the coupled
document is optimized for. This attribute specifies that the target URL is designed for
special devices like iPhones, speech, or print media.
37
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
syntax
<element media="value">
Supported Tags
Element Description
Example1: In this example we demonstrates the use of the media attribute, which is incorrect
for anchor elements. Instead, it uses the target attribute to specify whether links open in the
same or a different tab.
html
<!DOCTYPE html>
<html>
<head>
<title>HTML media Attribute</title>
</head>
<body>
<h2>HTML media Attribute</h2>
<a
href="[Link]
target="_self"
>
Click to open in the same tab
</a>
<br />
<a
href="[Link]
target="_blank"
>
Click to open in a different tab
38
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
</a>
</body>
</html>
Example2: In this example the media attribute specifies conditions (such as screen width)
under which different image sources defined in the <source> element are applied for responsive
design.
html
<!DOCTYPE html>
<html>
<head>
<meta
name="viewport"
content="width=device-width,
initial-scale=1.0"
/>
</head>
<body>
<picture>
<source
media="(min-width: 900px)"
srcset=
"[Link]
/>
<source
media="(min-width: 600px)"
srcset=
"[Link]
content/uploads/20190809013546/gfg_350X350.png"
/>
<img
src=
"[Link]
style="width: auto"
/>
</picture>
</body>
</html>
39
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML Semantic Elements
A semantic element clearly describes its meaning to both the browser and the developer.
Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.
Examples of semantic elements: <img>, <table>, and <article> - Clearly defines its content.
Many web sites contain HTML code like: <div id="nav"> <div class="header"> <div
id="footer"> to indicate navigation, header, and footer.
In HTML there are several semantic elements that can be used to define different parts of a
web page:
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
40
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML <section> Element
Chapters
Introduction
News items
Contact information
A web page could normally be split into sections for introduction, content, and contact
information.
<!DOCTYPE html>
<html>
<body>
<section>
<h1>WWF</h1>
<p>The World Wide Fund for Nature (WWF) is an international organization working
on issues regarding the conservation, research and restoration of the environment,
formerly named the World Wildlife Fund. WWF was founded in 1961.</p>
</section>
<section>
<h1>WWF's Panda symbol</h1>
<p>The Panda has become the symbol of WWF. The well-known panda logo of WWF
originated from a panda named Chi Chi that was transferred from the Beijing Zoo to
the London Zoo in the same year of the establishment of WWF.</p>
</section>
</body>
</html>
41
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML <article> Element
An article should make sense on its own, and it should be possible to distribute it
independently from the rest of the web site.
Forum posts
Blog posts
User comments
Product cards
Newspaper articles
<!DOCTYPE html>
<html>
<body>
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome
is the world's most popular web browser today!</p>
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has
been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015.
Microsoft Edge replaced Internet Explorer.</p>
</article>
</body>
</html>
42
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
HTML <header> Element
The <header> element represents a container for introductory content or a set of navigational
links.
Note: You can have several <header> elements in one HTML document.
However, <header> cannot be placed within a <footer>, <address> or
another <header> element.
<!DOCTYPE html>
<html>
<body>
<article>
<header>
<h1>What Does WWF Do?</h1>
<p>WWF's mission:</p>
</header>
<p>WWF's mission is to stop the degradation of our planet's natural environment, and
build a future in which humans live in harmony with nature.</p>
</article>
</body>
</html>
authorship information
copyright information
contact information
sitemap
back to top links
43
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
related documents
<!DOCTYPE html>
<html>
<body>
<footer>
<p>Author: Hege Refsnes</p>
<p><a href="[Link]
</footer>
</body>
</html>
The <div> element is by default a block element, meaning that it takes all available width,
and comes with line breaks before and after.
<!DOCTYPE html>
<html>
<style>
div {
background-color: #FFF4A3;
}
</style>
<body>
44
New L J Institute of Engineering and Technology
Subject: Web Application Development (BE05000281)
Branch: CSE/ CSE(DS) Semester: V
========================================================
</body>
</html>
<div> as a container
The <div> element is often used to group sections of a web page together.
<!DOCTYPE html>
<html>
<style>
div {
background-color: #FFF4A3;
}
</style>
<body>
<div>
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>London has over 9 million inhabitants.</p>
</div>
</body>
</html>
45