Disclosure: BHC is reader-supported. When you buy through our links, we may earn a commission.
HTML is the backbone of today’s internet. Millions of websites together formed the internet. Where HTML is the building block of all these websites. Twenty years ago, even if you are just a hobby blogger, you had to know some web coding to protect yourself or to add a simple function to your site. But now there are so many editors and plugins available that even knowing the basics of HTML is no longer required.
The problem with this is that if you don’t know a few basics, you can easily get into real trouble in your blog and have to hire a pricey developer to fix what may be a minor problem. Not only that, but creating changes to your blog such as adding a custom text widget requires a little knowledge.
And if you are experiencing content layout doesn’t look right, HTML knowledge can get you back on track.
Making Your First Site? Try No-Code Website Builder You don’t need coding skills to create a website with a builder like Wix. The tool comes with 800+ designer templates and allows you to manage your site from mobile > Try Wix for Free, Click Here
HTML is the abbreviation of Hyper Text Markup Language. It is the standard language for tagging contents for web browsers.
HTML is represented by “Elements”. Elements are also known as “Tags”.
Why is HTML needed?
Web browsers can only render a website when it is written in their supported language. HTML is the most common markup language and has the highest acceptance to web browsers.
That’s why you need HTML.
Is HTML case sensitive?
HTML is not case sensitive. But the best practice is to write HTML with proper cases.
Beginners-Friendly Hosting to Host Your HTML Projects
If you are a beginner, we recommend hosting providers that are affordable and easy to start with. Instant account activation, an easy-to-use control panel, comprehensive user guide, and helpful technical support that’s always ready to help are important requirements.
Very reliable hosting; also offer web design services (full review).
Steps for Creating Your First HTML File
You can create a basic HTML file using the Notepad on your computer. But it will be painful for writing many lines of codes.
You need a Code Editor. A good code editor will make it easier to write and organize large codes. I use and recommend Notepad++ (free and open-source) for writing web languages. There are other editors you may use like Sublime Text, Atom etc.
Copy and paste the following code into your new HTML file and save it. Now run it on your web browser.
HTML Code
<!DOCTYPE html>
<html>
<head>
<title>My first web page</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
Output:
Congrats! You have created your very first HTML file. You don’t have to understand it at this point. We will cover it shortly.
Understanding HTML Structure
Every HTML file has a common naked structure. This is where everything starts. And every large page of codes will come to this structure after trimming down.
So let’s try to understand it from the “Hello World!” code. The following elements are the mandatory parts for every HTML file.
<!DOCTYPE html> = It is a declaration to the browser that this is an HTML file. You must specify it before the <html> tag.
<html> </html> = This is the root element of an HTML file. Everything you write goes between <html> and </html>.
<head> </head> = This is the meta information part for a browser. Codes inside this tag have no visual output.
<body> </body> = This is the part that a web browser renders. What you exactly see on a website is the rendering of codes between <body> and </body>.
2. HTML Tags
HTML is the collaboration of hundreds of different tags. You need to learn how they work. You also have to make sure that they have used them in the right way.
HTML tags usually have an opening and a closing tag. The opening tag has the keyword surrounded by a less than (<) and a greater than (>) sign. The closing tag has everything same but an extra forward slash (/) after the less than (<) sign.
Head Tags
All the head tags go between <head> and </head>. They contain meta information for web browser and search engines. They basically have no visual output.
<title> </title>
Title tag defines the title of a web page which is visible on the browser tab. This information is used by web programs and search engines. You can have highest one title per HTML file.
Code:
<title>My first web page</title>
<link>
Link tag links your HTML page with external resources. Its main use is linking HTML page with CSS stylesheets. It is a self-closing tag and doesn’t need the ending </link>. Here rel stands for relation with the file and src means the source.
Meta is another self-closing tag that provides meta information of an html file. Search engines and other web services use these information. Meta tags are a must if you want to optimize your page for search engines.
Code:
<meta name="description" content="This is the short description that search engines show"
<script> </script>
The script tag is used for including a server-side script or making a link to an external script file. It can have two attributes in the opening tag. One is the type and another is the source (src).
Noscript tag works when scripts are disabled in a web browser. It makes a page compatible to them who don’t allow scripts in their web browsers.
Code:
<noscript><p>Alas! Scripts are disabled.</p></noscript>
Body Tags
All the body tags go between <body> and </body>. They have visual outputs. This is where the most work is done. You have to use these tags to structure your main page content.
<h1> </h1> to <h6> </h6>
These are the heading tags. The most important heading is tagged with <h1> and the least important with <h6>. You should use them in the correct hierarchy.
Code:
<h1>This is a h1 heading</h1>
<h2>This is a h2 heading </h2>
<h3>This is a h3 heading </h3>
<h4>This is a h4 heading </h4>
<h5>This is a h5 heading </h5>
<h6>This is a h6 heading </h6>