Ebook 23
Ebook 23
Ebook 23
Dej,2024
1
HTML
FROM 0
TO HERO
Dej,2024
2
Welcome!
This book is dedicated to all those who want to take the first steps in
web programming and step into a new world unknown to them until
this moment. I will not hide the fact that you should not have fast
expectations, believing that a programmer can qualify overnight. To
reach the desired level, it takes a lot of work, perseverance, ambi-
tion and most importantly, passion. In this book are all the lessons
that include Hyper Text Markup Language (HTML), there are ex-
ercises after each lesson, and of course a theme. To understand
the depth, you have to solve absolutely everything, developing
your horizon in terms of web programming. I will try to present each
chapter in a way that is as understandable as possible.
Success!
3
Cuprins
Introduction...............................................................6
What we use to create web pages?.........................8
How do I create my first project?..............................9
Chapter 1. Page structure........................................12
1.1 Simple structure..................................................12
1.2 Advanced structure(body content)......................14
1.3 Head content.......................................................16
1.4 Verification test....................................................16
4
Chapter 4. Advanced Tags................................
4.1 Lists.............................................................
4.2 How can I add an mp4, mp3 file to my web-
site?........................................................................
4.3 What does tag marquee & textarea?..........
4.4 <form>, <input>, <button>.................................
4.5 Emoji.................................................................
Chapter 5. Projects...............................................
5.1 Formular......................................................
5.2 A web page.................................................
5
How did the internet appear?
The web was invented in 1989 at the European Center for Nu-
clear Research (CERN) in Geneva, Switzerland. The original
proposal to create a collection of linked documents was made
by Tim Berners-Lee in March 1989. The proposal arose out of
communication
problems experienced by research teams using the
center, even using electronic mail. The term World Wide Web,
abbreviated WWW or www, also called web for short, is the
totality of sites / documents and hypertext-type information
linked to each other, which can be accessed through the
worldwide Internet
network. Documents, which reside in different
locations on different server computers, can be found
using a unique identifier called a URL. Hypertext
including images etc. it is displayed using a web browsing
program called a browser, which downloads web pages from a
web server and displays them on a
“client” terminal to the user.The WWW is only one of the many
computer services and applications
available on the Internet. Other services such as:
display of information in the form of text, images and sounds,
e-mail, transfer of data files and FTP information, chat, video
applications, Internet telephony and video telephony services
of the VoIP type, Internet radio and television, e-commerce,
opinion polls, news dissemination via RSS methods, all kinds
of graphics and music, remote computer work over the Inter-
net, discussion groups on various topics, interactive game
systems, distribution software etc.
6
The operation of the web is based on 3 standards, namely:
1) (HTTP) - Hypertext Transfer Protocol, the OSI
protocol stack through which the web server and the client
(user) browser communicate with each other;
2) (HTML)- Hypertext Markup Language, standard for defining
and presenting web pages;
3) (URI) - Uniform Resource Identifier, universal
system for identifying web resources, used to identify and find
web pages.
7
What we use to create web pages?
Well, maybe when you thought of a start in web
programming, you probably wanted to write the code in a text editor
like notepad, well no! What I recomend and we will use in this book
is actually Visual Code. You can also try in notepad but it is much
more
difficult because it does not show you the mistakes in real time and
for a beginner this can be a nightmare.
8
How do I create my first project?
Step 1:Go to Files/Documents
Step 2:Create a new folder named “HtmlProject”
Step 3:Create a file named “index.html”(windows 10), “index-
”(windows 11)-> In Windows 11, the default (txt) extension can
only be changed if you use a certain program, I will immediate-
ly show you how to change the extension
Step 4:Open Visual Code
Step 5:Click on “Open folder”
9
Step 6:Go to Documents
Step 7:Click on “HtmlProject” and click on “select”
Step 8:Right click on “index.txt”
Step 9:Click on Rename and replace “txt” with “html”
10
To see the progress of the pages in real time, click on exten-
sions and search for “live server” and install it.
11
1.Page Structure
To begin with, I would like to start with the simplified structure
of the web page because, being a beginner, you need a clear
understanding of the basics. My
recommendation is to understand how everything works to be
able to move on, don’t try to skip this
lesson if it’s your first time facing such a challenge.
<!DOCTYPE html>
<html lang=”en”>
<head>
<title>First Project</title>
</head>
<body>
<!--content-->
</body>
</html>
12
<body> -most importantly, the one that defines the content of a
web page
<!-- --> -it is a comment, it only removes certain
syntaxes from the code, not being applied in the code but re-
maining there as a reference.
<...lang=”en”> -specify the language in which it is made(En-
glish -> https://www.w3bai.com/ro/tags/ref_language_codes.
html#gsc.tab=0)
Next, we will analyze the entire structure of the web page, so
let’s get started!
13
The advanced structure has a much more developed body, the
context of the page being very well divided
<!DOCTYPE html>
<html lang=”en” >
<head>
<title>First Project</title>
</head>
<body>
<header>
<nav>
<!--content-->
</nav>
</header>
<main>
<aside>
<!--content-->
</aside>
<section>
<arcticle>
<!--content-->
</arcticle>
</section>
</main>
<footer>
<!--content-->
</footer>
</body>
</html>
14
HEADER
NAV
MAIN
SECTION ASIDE
ARCTICLE
FOOTER
15
We continue with the content of the head. What
content is in it, what tags are included, what do they do? Well,
there aren’t as many as you think there are.
1)href=URL
2)target=_blank:new window
If you don’t want a new tab, simply don’t specify the target.
1)<meta charset=”UTF-8”/>
2)<meta name=”author” content=”Chris”/>
3) <meta name=”viewport” content=”width=device-width, ini-
tial-scale=1.0”>
4) <meta name=”description” content=”Free Web
tutorials”>
5)<meta name=”keywords” content=”HTML, CSS, JavaS-
cript”>
Great! Now that I’ve finished the first chapter, I want to test
your knowledge to see how well you know the structure of the
web page
16
Verification Test
1) What does HTML mean?
2) <!DOCTYPE> means:
a) HTML version
b) Defines main content
c) after “head”
a) Nourth
b) West
c) East
a) <aside>
b) <header>
c) <footer>
17
Great! I hope you did very well! Being the first basic lesson,
you should have done all the correct questions, but if not, I
recommend you go back and study the lesson once more. The
answers to the questions are the following:
18
2.1 Start Tags
1) Paragraph <p>
<p> ->contains a paragraph, it is usually used as a product
description. In most cases it is positioned in <main>, but it can
also be in <footer> with additional information about your site
such as “Copyright 2024”.It is a simple text.
...<main>
<aside>
<p>This is a paragraph</p>
</aside>
<section>
<arcticle>
<!--content-->
</arcticle>
</section>
</main>...
19
To see the paragraph on the website, we will use the
extension we told you about earlier, namely “Live server”. To
see the progress, just go to the top left of the VC (Visual Code)
program, press “View”->”Command Palette” and look for “Live
server” then search the option “Live server: Open with Live
server”, that’s all!
To save each code change, press the “Ctrl+S”.
20
2) Heading (<h1>-<h6>)
...<main>
<aside>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</aside>
<section>
<arcticle>
<!--content-->
</arcticle>
</section>
</main>...
As we can see the titles are getting smaller and smaller, basi-
cally I took from the largest (<h1>) to the smallest (<h6>).
21
These tags are block elements. Block elements means when
tag 2 automatically moves to the next row without causing it
with a breakline <br> (we’ll talk about that in a moment).
22
3) <strong>, <b> & <small>
...<aside>
<strong>This is heading 1</strong>
<b>This is heading 2</b>
<small>This is heading 3</small>
</aside>...
23
4) <em> & <i>
...<aside>
<em>This is heading 1</em>
<i>This is heading 2</i>
</aside>...
24
5) <br> & <hr>
Ok, I’m glad that we can finally solve that dilemma with inline
elements and block elements!
...<aside>
<em>This is heading 1</em> <br>
<i>This is heading 2</i>
</aside>...
25
As you can see compared to last time, the <em> and <i> tags
are no longer on the same row, but now they are on different
rows thanks to the <br> tag. As I said before, the <hr> tag
deals with underlining/highlighting an element.
At the moment, with the knowledge we have, we do not know
how to specify the size and position of the horizontal line, but
we will learn this in the styling library, namely Cascading Style
Sheet (CSS).
...<aside>
<em>This is heading 1</em> <hr>
<i>This is heading 2</i> <hr>
</aside>...
26
2.3 How do I add images to my site?
Well, to add images to our site we need the <img> tag. Ok,
and how does it work? First of all, I want you to go to the folder
you created at the beginning (HtmlProject) and create anoth-
er folder inside it called “images” because there we will save
all the images.Now you just have to glorify an image of your
choice in that folder.
27
...<aside>
<img src=”images/Earth.jpg” alt=”Earth”>
</aside>...
28
In this case the image does not appear, only the text. How-
ever, the image can be taken directly from the Internet, this
would mean that there would be no need to download it and
put it in a folder. In this case the image does not appear, only
the text. However, the image can be taken directly from the In-
ternet, this would mean that there would be no need to down-
load it and put it in a folder. I do not recommend this option
because it is not efficient at all. Just imagine that the author
who posted the picture on the Internet deletes it and you are
just thinking about what you used for a website and one day
you notice on your website that instead of the image there is
only that alternative text. Of course, the first option remains the
most efficient, but ultimately it is up to the developer.
29
2.4 How do I create a table?
...<table>
<tr><th>Coloana 1</th><th>Coloana 2</th></tr>
<tr><td>Celula 1.1</td><td>Celula 1.2</td></tr>
<tr><td>Celula 2.1</td><td>Celula 2.2</td></tr>
</table>...
30
<table>- The table
<tr>- Table lines
<th>- Table columns(the main line)
<td>- Table columns(all other lines), cells
31
2.5 How can I navigate between the pages
of the site? (Hyperlinks)
To begin with, we will start with those that make the connec-
tion on the same tab. First of all, we will have to create another
web page, preferably we can just copy the index page and
note the new page with index 2.
<a href=”index2.html”>Link</a>
32
href=” ”- The path of that page
33
We notice that if we click on “Link” it takes us to the “index2”
page, staying on the same tab. Now we will move on to the
other category of Hyperlinks, namely those with different tabs.
34
2.6 How can I group items?
Well, there is not much to say here, everything is focused on
<div> and <span>. The major difference between the two is
that <div> is a block grouping element and <span> is an inline
grouping element.
...<div>First</div>
<div>Second</div>
<span>Third</span>
<span>Fourth</span>...
35
However, let me show you how <div> and <span> can still be
used.
36
2.7 Exercises
37
1) <!DOCTYPE html>
<html>
<head>
<title>First Website</title>
</head>
<body>
<p>First paragraph</p>
<p>Second paragraph</p>
<p>Third paragraph</p>
</body>
</html>
2) <!DOCTYPE html>
<html>
<head>
<title>First Website</title>
</head>
<body>
<a href=”project.html”>Project</a>
</body>
</html>
38
3) <!DOCTYPE html>
<html lang=”en” >
<head>
<title>First Project</title>
</head>
<body>
<header>
<nav>
<!--content-->
</nav>
</header>
<main>
<aside>
<p>First paragraph</p>
<p>Second paragraph</p>
<p>Third paragraph</p>
<p>Fourth paragraph</p>
</aside>
<section>
<arcticle>
<!--content-->
</arcticle>
</section>
</main>
<footer>
<!--content-->
</footer>
</body>
</html>
39
4) <!DOCTYPE html>
<html>
<head>
<title>First Website</title>
</head>
<body>
<img src=”images/example” alt=”Example”>
</body>
</html>
40
2.8 Verification Test
a)<h1>
b)<h4>
c)<img>
d)<title>
a)<table>
b)<th>
c)<tr>
d)<td>
a)<table>
b)<th>
c)<tr>
d)<td>
a)<strong>
b)<smaller>
c)<em>
d)<img>
41
5) The tag that makes the text bold is:
a)<smaller>
b)<a>
c)<i>
d)<b>
a)<i>
b)<table>
c)<strong>
d)<img>
a) Create a table
b) Inserts a new line between elements
c) Inserts an image
d) Connects two pages
42
Ok, I hope you did well in this test because this is the first real
step towards becoming a frontend developer. Normally you
should have solved at least 7 out of 8 considering the difficulty
of the verification test. However, if you have made less than
6-7 correct answers, I recommend you to go back and repeat
what I did once more because you cannot afford to make mis-
takes in the basic things. The answers are the following:
43
2.9 Homework
44
BONUS!
In this bonus section you will learn some optional tags that
are not commonly used in the website industry.So for the first
section we will learn the following tags:
1) <sub>
2) <blockquote>
3) <pre>
The biggest advantage of the <sub> tag is that you can write
chemical formulas, let me show you.
<p>H<sub>2</sub>O is water</p>
45
Next, we have the <blockquote> tag, which practically delimits
the text.
46
And finally the last tag, <pre>. This preformats the text, that is,
if you wrote it chaotically, it will be displayed on the web page
as well.
<pre>
Acest text
este preformatat
și menține
spațierea.
</pre>
47