HTML is a markup language For web pages. In fact, HTML stands for HyperText Markup Language.
One thing that needs to be made clear right away and kept in mind is that theHTML is not a programming language: HTML is only for format text and to layout elements such as forms, quotes, videos.
In this brief guide we will not dwell too much on technical or philosophical discussions of what is a hypertext, but we will take as our definition that of a web page, a navigable page on the Internet.
Tools
All you need to develop your first html page is a simple text editor, for Windows users the simple Notepad.
Our first HTML page
We open notepad and enter the following code:
<html></html>
We click save and choose a name "page.html" and from the drop-down menu "save as" let us remember to select "all files“.
At this point we have created our first html page, which when opened will show a blank page.
Each html page basically consists of two elements, a head <head> and a body <body>.
We modify our page in this way:
<html>
<head></head>
<body></body>
</html>
The DOCTYPE
At this point it is important to introduce the concept of DOCTYPE. The doctype is a declaration that is inserted at the beginning of the document that allows browsers to render the page correctly. In the case of HTML5 the doctype declaration is as follows:
<!doctype html>
<html>
<head></head>
<body></body>
</html>
In the past, longer and more articulate doctype statements were used, but now theHTML5 is a standard, so we will limit ourselves only to this one.
Adding a title to the HTML page: the title tag
If we try to open the previously created html page, we will see that the window bar will show the file path. If we want to add a more explanatory title, we can add the tag
<!doctype html>
<html>
<head>
<title>My first web page</title>
</head>
<body></body>
</html>
In addition to making the page more user-friendly, the presence of the title is also important on the side SEO.
Tags
One of the first things we can notice is that HTML is a language composed of tags. Each HTML tag is always enclosed between a minor sign ( ). A generic tag is characterized by the following syntax:
<nomedeltag>
Tags can provide an opening <nometag> and a closing </nometag>,
<h1>Article Title</h1>
or be tags that contain no elements so they are self-closing. An example of the latter type of tag is. <img />.
<img src="mondo.jpg" />
In this brief guide we will not analyze all html tags, but only the most frequently used ones. For an exhaustive list of all tags you can look at here.
Let's see what the main tags are and how to use them.
The tag <h1> and the other headings
The tag <h1> is used to define a heading (title, header), which is text that has greater importance within the content of our html page, so it will be formatted with a larger font.
There are various header tags based on importance: therefore, you can have <h1>, <h2> , <h3> , <h4> , <h5> , <h6>.
<h1>Page title</h1>
The tag <p>
The <p> is used to define a paragraph. By inserting text within this tag, it will be formatted as free text.
<p>On this page we will discuss HTML.</p>
The tag <b>
The tag <b> Is used to highlight text:
<b>very important text</b>
Its operation is identical to that of the tag <strong>, bold a portion of text.
The tag <a>
The tag <a> is used to define a link (links between web pages) allows us to create a link from our page to another page. The syntax of a link is as follows:
<a href="https://www.google.it">Link to Google</a>
We can see that the tag <a> needs the href attribute indicating the destination page.
The tag <img>
The tag <img> is used to insert an image within the HTML page. Unlike the previous tags, the <img> is a self-closing tag, that is, it does not need a closing tag.
<img src="immagini/terra.jpg" />
As we see in the example, the tag <img> needs the src attribute, which indicates the path to the image to be displayed. The tag <img> Can also have other attributes:
<img src="immagini/terra.jpg" alt="image of the Earth" />
In this example, the alt attribute is used to display alternative text in case the image does not load. It is also useful for indicating to search engines what is displayed on the page, which is very important from an SEO perspective.
The list tags , , - .
- ,
- .
If we want to show a list in our html page we can use the
- tag. This tag shows an unordered list, so a dot will appear at the side of each list item. In case we want to show a numbered list we can use the
- tag.
<ul> <li>Primo punto</li> <li>Secondo punto</li> <li>Terzo punto</li> </ul>
Mini tutorial: how to create your first web page
After taking a quick look at the main html tags, we can try to create our first web page.
We open Notepad or any other text edtor and start typing this code inside:
<!doctype html> <html> <head> <title>My first web page</title> </head> <body></body> </html>
Save as and remember to select "All files" in the drop-down box, after which we save as index.html o mypage.html Or whatever we like best.
If we double-click on the file we just saved, a new browser window will open with our first html page. It will be a blank page, but it will have the title we entered in the tag
. Let's go ahead and build the web page. Let's add a header and a few paragraphs. Let's apply the tag <b> to a few words to highlight, such as the name of the city of Birth, add a photo with the tag <img> and a link to the page on Wikipedia.
<!doctype html> <html> <head> <title>My first web page</title> </head> <body> <h1>Lionel Messi</h1> <p>Lionel Andrés Messi, called simply Leo by many, was born on June 24, 1987 in <b>Rosario</b>, in the Argentine state of Santa Fe. </p> <img src="Messi.jpg" /> <p>He is only five years old when he starts kicking the ball for the first time. His first team is the <b>Grandoli</b>, a small soccer school in his town aimed at children. Coaching the boys is Jorge Messi, a metalworker employee and father of the future champion. </p> <p>At the age of seven <a href="https://it.wikipedia.org/wiki/Lionel_Messi">Lionel Messi</a> he wears the jersey of "Newell's Old Boys" and plays in the youth categories. To the eyes of the soccer fans who followed the young boy in the small fields of Rosario, the talent of the youngster was already clear. </p> <h2>The arrival in barcelona</h2> <p>Because of a delay in the boy's bone development due to low levels of growth hormones in his body, the transition fades. </p> <p>Medical treatment is recommended to the family, but it is very expensive: it is reported to be $900 monthly; Jorge Messi asks for help from Newell's Old Boys and River Plate without getting adequate solutions. He strongly believes in Lionel's possible future as a champion: so he asks some foundations for help. </p> </body> </html>
If we want to insert an image, we can save it in the same folder as the html file and retrieve it by entering the file name in the attribute src of the tag <img>.
If we have done everything correctly, we should get something like this:
In this brief guide on HTML we have seen how to make a web page, add text and images, format a header and bold text, and add links.
To improve our page we will need to change its appearance, using the CSS. This will be the subject of a future guide.
- tag.
Each list item must be enclosed within the
Leave a Reply