For working professionals
For fresh graduates
More
Learn HTML: A Comprehensive Tu…
1. HTML Tutorial
2. HTML Basics
Now Reading
3. HTML Syntax
4. HTML Elements
5. HTML Attributes
6. HTML Comments
7. HTML Semantic
8. HTML Form Elements
9. HTML Head
10. HTML Title
11. HTML Styles
12. HTML Paragraphs
13. HTML Symbols
14. HTML Emojis
15. HTML Formatting
16. HTML Entities
17. HTML Audio
18. HTML Images
19. HTML Lists
20. HTML Links
21. SVG in HTML
22. HTML Forms
23. HTML Video
24. HTML Canvas
25. Adjacency Lists
26. HTML Input Types
27. HTML Tables
28. HTML Table Border
29. Cell Spacing and Cell Padding
30. HTML Semantic Elements
31. HTML Layout
32. html blocks and inline
33. HTML Div
34. Difference Between HTML and CSS
35. Image Map in HTML
36. HTML Drag and Drop
37. HTML Iframes
38. Divide and Conquer Algorithm
39. Difference Between HTML and XHTML
40. HTML Code
41. HTML Colors
42. HTML CSS
43. HTML Editors
44. HTML Examples
45. Class in HTML
46. HTML Exercises
47. HTML ID
48. Understanding HTML Encoding: A Comprehensive Guide
49. HTML Table Style
50. HTML Script
51. Introduction to HTML
In today's digital age, the online world offers endless possibilities. From e-commerce to entertainment, there's a website for nearly every need. But have you ever wondered how these websites come to life and evolve over time? The answer lies in HTML, the foundation of web development.
I’ve always wanted to curate a clear and easy guide to HTML basics having been a web developer myself.
Drawing from years of personal experience within the web development sector, this tutorial can be a great introduction of HTML language for beginners.
First things first, let's define HTML briefly.
When a web page is created, the structure and the formatting of the page are directed by HTML or Hypertext markup language code. HTML contains a bunch of elements that can be used for various purposes to make the webpage according to our wishes.
The tags or elements used in HTML can be used for hyperlinking a word or an image, editing the look of the website, and changing fonts just to name a few.
I’ve explained it below with a basic HTML program example.
Say I want to write a paragraph on our website. I can do so using the <p> tag. But this might be a little boring and not catch attention.
Code:
<!DOCTYPE html>
<html>
<body>
<p>This may be generic information. But we want this part of the paragraph to be bold. This again is generic information.</p>
</body>
</html>
As you can see, the important part we want to make sure stands out looks nothing special. To make the important information stand out, we can make the important information bold with the help of the <b>(<b> is the bold tag) tag.
Let me show you how.
Code:
<!DOCTYPE html>
<html>
<body>
<p>This may be generic information. <b>But we want this part of the paragraph to be bold.</b> This again is generic information.</p>
</body>
</html>
Here the use of the <b> tag as you can see made the important information stand out.
Let us understand the basic structuring of HTML elements first. This will help us understand the future concepts better. Let us take an example. Here I have attached an HTML element below, let us dissect it.
In this example, the opening tag is <h1>. The opening tag indicated the beginning of the HTML element.
We put the content or the information of an element between the opening and closing tags. Not all elements include material. Here, the content is “Machine Learning Workshop”.
The closing tag always has a backslash while starting followed by the name of the element. This marks the end of the element. Here, the closing tag is </h1>.
We have already covered how HTML elements work, now let us look at a simple HTML code to understand its structure. Let me explain with the help of an example.
Code:
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My test page</title>
</head>
<body>
<p>This is a HTML test webpage.</p>
</body>
</html>
Now let me explain each element used in the above basic HTML website template.
<!doctype html>
The doctype tag as the name suggests is a declaration at the beginning of an HTML document that identifies the document type and HTML version in use. HTML5 documents are marked to follow the HTML specification.
<html></html>
This element, also called the root element, wraps around the entire code. It also includes the language instruction, which specifies the default language of the document.
<head>
This element is a container for metadata and other items that are not readily visible on the webpage. It is put between the opening and tags.
<meta name="viewport" content="width=device-width">
In HTML, the tag controls a webpage's layout and scaling for different devices.
<title></title>
The <title> tag is used to display the name of the website on the browser tab. If used correctly, it even makes the website SEO-friendly.
<body></body>
The element in HTML contains a webpage's visible content. It includes everything that users see and engage with while visiting the page.
In this section, I will teach you how to include images in your HTML document. First, let us look at the syntax of the process.
<img src="images/HTMLtest.png" alt="My test image" />
In this format, src stands for source. It is used to tell the compiler where to look for the image in your system. Here, the name of the file is HTMLtext.png and it is present inside a file named images.
We include the alt text to communicate to other developers which image is being used. This saves a lot of time as the developer does not have to constantly look for which image is being used.
In this section of the tutorial, I will show you some of the most important text elements used in a basic HTML page.
Headings in HTML define the order of content and importance of text on a webpage. Headings are divided into six levels with each level the size grows smaller. Let us look at an example to understand it better.
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<h1>This will be the biggest heading</h1>
<h2>This heading will be a little smaller</h2>
<h3>This heading will be a little smaller still</h3>
<h4>This will be the smallest heading</h4>
</body>
</html>
As you can see, <h1> is the biggest, followed by <h2>,<h3>, and so on.
As used in earlier examples, the <p> tag is used for inserting paragraphs into an HTML file. The format for using paragraphs is.
<p> Example to explain paragraphs</p>
Here, content that is encased in the <p> tags is “Example to explain paragraphs” and that will be shown in the final website.
Links in HTML are created with the (anchor tag) element. Links enable users to move between web pages, elements, or resources. Let me demonstrate with the help of an example
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<p> Visit
<a href="https://www.upgrad.com/">
uPGrad
</a>
to learn more about HTML.</p>
</body>
</html>
Here, the term upGrad is linked with their website. Thus if someone clicks the word, it will take them to uppGrad’s website directly.
Now let us discuss lists with the help of examples. There are mainly four types of lists used in a basic HTML page.
An ordered list is used when the order of elements is important, such as in a process or a numerical sequence. The browser automatically numbers each list item. Let us look at an example.
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<ol>
<li>I woke up.</li>
<li>I went to work.</li>
<li>I came back home.</li>
</ol>
</body>
</html>
When the order of the list is not important, an unordered list is used in HTML. For example, say a list of fruits. Unordered list items are usually shown in bullet points
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<ul>
<li>Apples are red.</li>
<li>Oranges are orange.</li>
<li>Bananas arre yellow.</li>
</ul>
</body>
</html>
If we want to list things inside a pre-existing list, the concept of nested lists can be used. Let me show you an example to explain the concept better.
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<ul>
<li>Main List 1</li>
<li>Main List 2
<ul>
<li>Sub-List 2.1</li>
<li>Sub-List 2.2</li>
</ul>
</li>
<li>Main List 3</li>
</ul>
</body>
</html>
When we want to mention the description of an item in the list along with the item, we generally use a description list. The list item is called <dt> and the information is called <dd>.
Code:
<!doctype html>
<html lang="en-US">
</head>
<body>
<dl>
<dt>Apple</dt>
<dd>Appple is a fruit.</dd>
<dt>Eggplant</dt>
<dd>Eggplant is a vegetable.</dd>
</dl>
</body>
</html>
Another important concept to know in HTML is attributes. Let me teach about attributes and teach with the help of an example.
Attributes in HTML give additional information about HTML elements or indicate how they should behave or appear. They are included in element opening tags and written as name-value pairs.
In this simple HTML code line, href=”#register” and target=”_self” are the attributes. Here, the anchor tag keyword ‘Registration’ when clicked will take you to the register on the same page.
When an attribute value includes a space or a special character, it must be enclosed in double-quotes. If an attribute value is case-sensitive in HTML, it will also be case-sensitive when used as a selector in CSS and JavaScript.
HTML is an important skill to have if you are planning to work in the field of web development. It is still quite popular and a very sought-after skill to have to land a job in today's market.
Here in this HTML tutorial for beginners, only HTML coding basics are covered. If you want to master more complex HTML basics and concepts, I recommend checking out upGrad's certification classes. The courses are developed in partnership with the world's top universities and are guaranteed to offer you vital insights.
Headings, paragraphs, links, images, and lists are some basic topics of HTML.
The 12 basic tags in HTML are.
Some simple functions of HTML are defining elements, text formatting, creating links, inserting images, and making lists, tables, forms, and comments to name a few.
The basic HTML structure is.
HTML syntax refers to the rules and structure for writing HTML code. In brief, HTML syntax comprises tags, attributes, nested structure, empty elements, and comments.
HTML aims to structure and format web content
Here's a simple step-by-step explanation of how HTML works:
HTML is used to construct and structure web content, enabling developers to design and display text, graphics, links, forms, and other elements consistently. It is required for creating web pages and guaranteeing uniformity.
Author
Talk to our experts. We are available 7 days a week, 9 AM to 12 AM (midnight)
Indian Nationals
1800 210 2020
Foreign Nationals
+918045604032
1.The above statistics depend on various factors and individual results may vary. Past performance is no guarantee of future results.
2.The student assumes full responsibility for all expenses associated with visas, travel, & related costs. upGrad does not provide any a.