HTML Unit 1 and 2
HTML Unit 1 and 2
1.INTRODUCTION TO HTML:
⮚ HTML elements label pieces of content such as "this is a heading", "this is a paragraph",
⮚ All HTML documents must start with a document type declaration: <!DOCTYPE html>.
⮚ The HTML document itself begins with <html> and ends with </html>.
⮚ The visible part of the HTML document is between <body> and </body>.
⮚ Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
OUTPUT:
My First Heading
My first paragraph.
⮚ The <!DOCTYPE> declaration represents the document type, and helps browsers to
display web pages correctly.
⮚ It must only appear once, at the top of the page (before any HTML tags).
⮚ <!DOCTYPE html>
HTML Headings:
<h1> defines the most important heading. <h6> defines the least important heading
2.HTML Basic Structure
// for Break
<br>
HTML Links
Example
HTML Images
The source file (src), alternative text (alt), width, and height are provided as attributes:
Example
3.WHAT IS INTERNET:
The Internet is an increasingly important part of everyday life for people around the world. But if
you've never used the Internet before, all of this new information might feel a bit confusing at first.
Throughout this tutorial, we'll try to answer some basic questions you may have about the Internet
and how it's used. When you're done, you'll have a good understanding of how the Internet
works, how to connect to the Internet, and how to browse the Web.
The Internet is a global network of billions of computers and other electronic devices. With the
Internet, it's possible to access almost any information, communicate with anyone else in the world,
and do much more.You can do all of this by connecting a computer to the Internet, which is also
called going online.
The purpose of a website can be almost anything: a news platform, an advertisement, an online
library, a forum for sharing images, or an educational site like us.
One of the best features of the Internet is the ability to communicate almost instantly with anyone
in the world. Email is one of the oldest and most universal ways to communicate and share
information on the Internet, and billions of people use it. Social media allows people to connect in
a variety of ways and build communities online.
There are many other things you can do on the Internet. There are thousands of ways to keep up
with news or shop for anything online. You can pay your bills, manage your bank accounts, meet
new people, watch TV, or learn new skills. You can learn or do almost anything online .
The web browser is an application software to explore www (World Wide Web). It provides an
interface between the server and the client and it requests to the server for web documents and
services. It works as a compiler to render HTML which is used to design a webpage. Whenever
we search for anything on the internet, the browser loads a web page written in HTML, including
text, links, images, and other items such as style sheets and JavaScript functions. Google Chrome,
Microsoft Edge, Mozilla Firefox, and Safari are examples of web browsers.
The choice of a web browser depends on the user’s preference and requirements. To know more
about individual browsers please go through our Web Browser – A Complete Overview
A web browser helps us find information anywhere on the internet. It is installed on the client
computer and requests information from the web server such a type of working model is called a
client-server model.
Client-server model
The browser receives information through HTTP protocol. In which transmission of data is
defined. When the browser received data from the server, it is rendered in HTML to user-readable
form and, information is displayed on the device screen.
5.WEB PAGES
A webpage is a digital document that is linked to the World Wide Web and viewable by anyone
connected to the internet having a web browser. It can contain any type of information, such as
text, color, graphics, animations, videos, sounds, etc.
A webpage is a document that is written in the HTML, it can be viewed from the Internet. It can
be accessed by entering the URL on the address bar of the web browser.
ContentWise :
Hypertext :
It refers to a digital text, which is more than just text as it can include information in various media
formats such as :
⮚ text
⮚ color
⮚ graphic
⮚ animation
⮚ video
⮚ sound
⮚ hyperlinks
Hyperlinks :
It refers to a link from a hypertext file to another such file. A hyperlink can be in the form of a
graphic or text, upon clicking where the linked document opens up.
Page Title – This is a single line text which is displayed on the title bar of the browser displaying
web page.
Header – This is generally a one or two line text (sometimes a graphics/image) defining the
purpose of the web page. It is displayed at the top of the web page, below the address bar of the
browser.
Body of the Web page – This is the section below the header of the web page and it contains the
actual content of the web page.
Navigational Links – These are the hyperlinks placed on the web page using which you can move
the linked web pages/documents.
Footer –
This is the bottom section of the web page. This is the section where usually the copyright notice,
website contact information, etc. is put.
Usually, most HTML tags come in pairs, consisting of an opening tag and a closing tag. The
opening tag marks the beginning of an element, while the closing tag, which includes a forward
slash before the tag name, indicates the end of that element.. Each tag has a different meaning and
the browser reads the tags and displays the contents enclosed by it accordingly.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
OUTPUT:
<details> Defines additional details that the user can view or hide
UNIT II
⮚ HTML uses predefined tags and attributes to instruct the browser on how to
display content, including formatting, style, font size, and images. HTML is a
case-insensitive language, meaning there is no distinction between uppercase and
lowercase letters.
⮚ Paired Tags: These tags come in pairs i.e. they have both opening(< >) and
closing(</ >) tags.
⮚ Empty Tags: These tags are self-closing and do not require a closing tag.”
Below is an example of a <b> tag in HTML, which tells the browser to bold the text
inside it.
Tags and attributes
HTML tags are structural components enclosed in angle brackets. They are typically opened and
closed with a forward slash (e.g., <h1></h1>). Some tags are self-closing, while others support
attributes like width, height, and controls for defining properties or storing metadata.
Structure of an HTML Document
An HTML Document is mainly divided into two parts:
● HEAD: This contains the information about the HTML document including the Title of the
page, version of HTML, Meta Data, etc.
● BODY: This contains everything you want to display on the Web Page.
Block-level Elements:
A block-level element always starts on a new line, and the browsers automatically add some
space (a margin) before and after the element.
A block-level element always takes up the full width available (stretches out to the left and right
as far as it can).Two commonly used block elements are: <p> and <div>.
The <p> element defines a paragraph in an HTML document.The <div> element defines a
division or a section in an HTML document.
Example
<p>Hello World</p>
<div>Hello World</div>
Below mentioned all the elements are block level elements, they all start with a
new line on their own, and anything that follows them appears on the next line.
In this example, we are going to use some of the block level elements. On executing the below
HTML code, it will produce one heading and two paragraphs separated by a horizontal line
Open Compiler
<!DOCTYPE html>
<html>
<head>
<title>HTML Block Level Elements</title>
</head>
<body>
<h3>HTML Block Level Elements</h3>
<p>
This line will appear in the next line
after Heading.
</p>
<hr>
<p>
This line will appear after Horizontal
Line.
</p>
</body>
</html>
OUTPUT: HTML Block Level Elements
Inline Elements
Inline elements, on the other hand, can appear within the same line and do not start a new line on
their own. Some common inline elements are as follows:
List of HTML Inline Elements
Below mentioned all the elements are inline elements, they did not start with a new line on their
own.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Online HTML Editor</h1>
</body>
</html>
OUTPUT:
Setting the style of an HTML element, can be done with the style attribute.
<tagname style="property:value;">
Background Color
The CSS background-color property defines the background color for an HTML element.
Example
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Text Color
The CSS color property defines the text color for an HTML element:
Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
Fonts
The CSS font-family property defines the font to be used for an HTML element:
Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>
Text Size
The CSS font-size property defines the text size for an HTML element:
Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML element:
Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
-------------------------------------------------------------***********---------------------------------------