HTML, also known as Hyper Text Markup Language (HTML), is the standard markup language used for web pages and online apps. You can see the four letters at the top of a web page if you right-click and hit inspect. But what is HTML? What is HTML used for? What is it used for? And how does it differ to other programming languages? Continue reading to learn more.
What is HTML?
HTML is everywhere and almost all coders, whether they are newbies or professionals, know how to use it. It tells your computer what information to display and where. Where should this menu go Is this text a title? Or a paragraph? Is this a hyperlink? How big should this image? HTML is not a programming language. It doesn’t do any algorithms, queries, or fancy math. It is used to create structures for your documents using tables, sections and paragraphs. It is a well-organized and cleverly arranged list of elements and attributes that makes up the web pages, web applications, documents, and emails that you see every day.
HTML Example
Take a look at this snippet code. I’m the tab at top of the screen. You can see that I’m a heading. This is code for a very basic document. This is what the HTML preview tool will look like if you paste this code. It’s quite simple. Let’s break it down.
!DOCTYPE HTML>: This tells your computer which language the document is written in (in this instance, web page).
: This is where the document begins. Everything lives within this tag (more details below).
This is the page’s title. It will be the title that users see in the tab at top.
: All your content is here.
This is the headline of your document that your users will see.
This is the standard paragraph text. This is the most common text you’ll use.
What is HTML?
Every website will have many different HTML pages (documents). Let’s take our site as an illustration. We have a homepage. A contact us page. We have tons of articles and blogs. Each of these have their own HTML files. A web browser will read the HTML file and render its contents. (Show it to me. Email providers will do the exact same with HTML emails. And so on. But how does it know which is which? The answer is elements and attributes. These are used to tell the browser what each section should look like. Let’s dig a little deeper.
What are elements in HTML?
Elements are the various types of sections within your code. They are often referred to as tags and are usually divided into three parts.
Opening tag: This tag tells the browser what the browser should do with the next piece of text.
The text between. This is what the user sees most often.
Closing tag This tells the browser that it is done.
Take, for example:
This sentence has a tag at its beginning. The content is the writing you are reading. There’s also a tag at the end. There is usually an open and close tag. This tells the browser what content is and when it should stop being there. You might also use:
This is the HTML element that you will use at the beginning of every HTML file. It is used to define HTML. Don’t panic. This is not something you will need to do with a close friend. Consider it a statement.
and are the most common. It tells the browser that HTML is being used for the next bit. (And not JavaScript, for example.) This will contain all other elements, attributes and codes. These elements, attributes and codes will not be combined in one document.
and: You’ll place all of your meta information (things about the file) here. A meta description, for example, is the text that appears under a Google search result.
and are the visible page stuff (all the main content).
This is a large heading. And can be used from h1 to h6.
and
are paragraph text.
and are two examples of . This is a list. This is what we are using now. We are using an (unordered) list.
You might see a. This is a section that’s styled with CSS. This section is styled with CSS. We have written an article on the topic.
What are HTML attributes?
Attributes add additional characteristics to your code