If you build a website you will need HTML. HTML is a makeup language that is needed to construct your website content like text and images. In this tutorial we will focus in HTML 5 because that is the most recent and most used version. So lets get started with HTML.
Get started
To Get started with HTML you must first create a HTML file by creating a text file called index.html. The index.html file will always be the first page you see when opening a website. At the first line of your index.html file you should write down <!DOCTYPE html> That will also give the browser a hint that this is a website file. Beyond that you write down <html>. If you see a word that is inside <> that means it is a div. If you only see <div> then it means it is opening a div. But if it looks like this </div> it is closing the div. So it is important that you always close a div after you open it. It is possible to place a div inside another. Remember to end the HTML file with </html>. So lets do this step by step:
- Create a text file named index.html.
- At the first line write down <!DOCTYPE html>.
- Beyond that write down <html>.
- At the end of the document write down </html>.
The head above the body
Between the <html> and the </html> you must always have a Head and a Body. Lets start with the head. The head is the part of the website you don’t see when visiting it. Inside the head you find links to other files that must be loaded in the HTML like CSS and Javascript. The title is also placed inside the head. The rest of the website is inside the body. The body is the part of the site you can see when you visit it. At the top of the body you will see a Navigation and a Header. Beyond that comes the content of the site. At the bottom you will find the footer. After you close the body you will close the HTML. Lets try it out:
- Open the head under the <html>.
- Leave one empty line and then close the head.
- Under the closed head open the body.
- Open a <h1> tag and write down a title and close the h1 after.
- Close the body before the </html>
- Open the index.html file in you browser
What is a Div
A div is the word between the <>. Some divs are pre made like <body> , <nav> and <footer>. These are the divs you always need when using a website but it is possible to make your own as well. You can use a div class or a div id. To make one write down <div id=”divname”> or <div class=”divname”>. If you close a div class or id you must write down </div>.
- Open a div id with the name test.
- Write down a <p> and add some text to it.
- Close the <p> and after that close the div like this </div>.