
Introduction to HTML: What is HTML and How it Works
By: CHRISTOPHER A TITUS
March 10, 2022
HTML stands for Hypertext Markup Language and it is a widely used programming language used to develop web pages. Through this HTML Tutorial, we’ll understand what HTML means, the features of HTML, the
Hypertext stands for Link between web pages.
Markup Language means Text between tags that define the structure.
HTML is a markup language that is used to create web pages. It defines how the web page looks and how to display content with the help of elements. It forms or defines the structure of our Web Page, thus it forms or defines the structure of our Web Page. We must remember to save your file with .html extension. In this HTML Tutorial, we’ll understand all the basic concepts required to kick-start your journey in HTML.
Applications of HTML
HTML is used for various purposes. Let us take a look at them
1). Web Pages Development
HTML is famously used for creating web pages on the world wide web. Every web page contains a set of HTML tags and hyperlinks which are used to connect other pages. Every page on the internet is written using HTML.
2).Navigating the Internet
Navigating on the internet would have been quite a tedious task without HTML. The anchor tags of HTML allows us to link pages and navigate easily. Imagine our life without anchor tags, you would literally have to enter URL every time. Using anchors tags, you can also navigate within a webpage.
3). Embedding Images and Videos
HTML allows us to embed images and videos with ease and gives us features to adjust height, position and even rendering type. You can adjust controls, thumbnails, timestamps and much more for videos. Earlier this was done using Flash and HTML has made it easier with the help of <video> tag.
4). Client-side storage
HTML5 has made client-side storage possible using localStorage and IndexD due to which we no longer need to reply on Cookies. Both of these tactics have their own set of rules and characteristics. String-based hash-table storage is provided by localStorage. Its API is straightforward, with setItem, getItem, and removeItem functions available to developers. On the other hand, IndexDB is a larger and more capable client-side data store. With the user’s permission, the IndexDB database can be enlarged.
5). Game development
Although you cannot create complex high-end video games with HTML, the <canvas> element of HTML can be used to make 2D and 3D games using CSS and JavaScript which can be run on browsers.
6). Data entry support
With the usage of new HTML5 standards in all the latest browsers, developers can simply add the tags for required fields, text, data format, etc. and get the data. HTML5 now has several new attributes for data-entry and validation purposes.
7). Interacting with Native APIs
With the help of HTML, you can interact with your Operating system. With this feature, you can easily drag files onto a web page to upload, full-screen a video, and much more.
Features Of HTML
- The learning curve is very easy (easy to modify)
- Creating effective presentations
- Adding Links wherein we can add references
- Can display documents on platforms like Mac, Windows, Linux, etc
- Adding videos, graphics, and audios making it more attractive
- Case insensitive language
HTML Editor
- Notepad
- Notepad++
- Atom,
- HTMLpad 2020
- Sublime Text (latest version is 4)
HTML Skeleton
<!DOCTYPE html> <html> <head> <title></title> </head> <body> </body> </html>
HTML Basic
<!DOCTYPE html>
Instruction to the browser about the HTML version.
<html>
Root element which acts as a container to hold all the code
The browser should know that this is an HTML document
Permitted content: One head tag followed by one body tag
<head>
Everything written here will never be displayed in the browser
It contains general information about the document
Title, definitions of CSS and script sheets
Metadata(information about the document)
<body>
Everything written here will be displayed in the browser
Contains text, images, links that can be achieved through tags
Examples:
<p> This is our first paragraph. </p>
<a href=”http://www.google.com”>Go To Google</a>
<img src=”photo.jpg”>
HTML Comment
Comments don’t render on the browser
Helps to understand our code better and makes it readable.
Helps to debug our code
Three ways to comment:
Single line
Multiple lines
Comment tag //Supported by IE
HTML Elements
Elements are created using tags
Elements are used to define the semantics
Can be nested and empty
What is HTML Elements Definition
<p color=”red”> This is our first Paragraph </p>
Explanation:
Start tag: <p>
Attributes: color =” red”
End tag : </p> // optional
Content: This is our first Paragraph
Types of Elements
There are different types of elements in HTML. Before moving ahead in the HTML Tutorial, let us understand the types of elements.
Block Level
○ Takes up full block or width and adds structure in the web page
○ Always starts from the new line
○ Always end before the new line
○ Example:
<p >
<div>
<h1>…<h6>
<ol>......<ul>
Inline Level
○ Takes up what is requires and adds meaning to the web page
○ Always starts from where the previous element ended
○ Example :
<span>
<strong>
<em>
<img>
<a>
HTML Attributes
Properties associated with each tag is called an Attribute.
<tag name=”value”></tag> is the structure.
There are some Global Attributes that can be applied to all the tags.
Title: Add extra information (hover)
Style: Add style information(font,background,color,size)
There are some attributes that can be applied to specific tags.
<img src=” URL” width=”100” height=”70” alt=” File cannot be loaded”>
src is the attribute used in image tag to define the path
Width is an attribute used to define width in pixels
Height is an attribute used to define width in pixels
Alt i.e alternate text if an image is not loaded
<a href=” URL”> Name of the link </a>
href is used for defining the path of the link
<hr color=”red”>
color is used to set the color of the horizontal line drawn on the webpage.
HTML Tags
Enclosed within < >
Different tags render different meanings.
Example:
<title>
Whatever is written this tag comes up in the web page’s tab
Defines the title of the page
Syntax: <title>Home </title>
<p> Defines the paragraph Syntax:<p > This is our first Paragraph </p>
List of Self-closing tags
● <hr> tag Stands for horizontal rule
● <br> tag Stands for break line
○ Moving to next line
○ Syntax: <br>
● <img> tag
○ To add images in the web page Syntax: <img src=”path”>
Example:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <img src="https://images.unsplh.com/photo-1592195241233-84b15fc81ecb?ixlib=rb-1.2.1&ixid=eyJhcHBfMDd9&auto=format&fit=crop&w=1950&q=80" title="lotus" style="width:500px"> </body> </html>
● <h1> tag …… <h6>tag
○ Stands for heading tag
○ Defines heading of a page
○ h1 represents most important page in the page
○ h6 represents least important page in the page
○ Syntax: <h1>This is my first heading </h1>
○ Example:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <h1>This is heading 1 </h1> <h2>This is heading 2 </h2> <h3>This is heading 3 </h3> <h4>This is heading 4 </h4> <h5>This is heading 5 </h5> <h6>This is heading 6 </h6> </body> </html>
● <strong> tag
○ Defines the text to be bold
○ Replaced <b>tag //HTML5
○ Syntax: <strong> This text is important </strong>
○ Example
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <p> Lorem ipsum dolor sit <strong>amet, consectetur adipisicing elit, sed do eiusmod</strong>tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </body> </html>
● <em> tag
○ Defines the text to be bold
○ Replaced <i>tag //HTML5
○ Syntax: <em> This text is special </em>
○ Example
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <p> Lorem ipsum dolor sit <em>amet, consectetur adipisicing elit, sed do eiusmod</em>tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </body> </html>
● <ol> tag
○ Stands for an ordered list
○ To define a series of events that take place in some order
○ Example making a tea (like a flow chart)
○ Syntax: <ol>………</ol>
● <ul> tag
○ Stands for unordered list
○ To define a series of events that take place where the order is not important.
○ Example your hobbies
○ Syntax: <ul>………</ul>
● <li> tag
○ Defines the list item
○ Used inside the ol and ul tag to define the events
○ Syntax: <li></li>
○ Example:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <ul> <li> Cricket </li> <li> Football </li> <li> Hockey </li> </ul> </body> </html> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <ol> <li> Cricket </li> <li> Football </li> <li> Hockey </li> </ol> </body> </html>
● <div> and <span> tags
Both of these are used to group different tags .
Thanks for this article,
ReplyDeleteIt gave me understanding of html.
Great
DeleteI request you write some articles python web development using Django.
ReplyDeleteCheck our github, repository groc coding school
DeleteOur pleasure!
ReplyDelete