Tutorial credits to Asabeneh

Day 01 Introduction

Difference between HTML, CSS and JavaScript

Credit to medium article

Web Development

Web development is a process of designing, building, and maintaining a website which ranges from a simple single page static website to a complex full-stack applications. This filed has two broad categories.

  • Web development
    • Frondend
    • Backend

Frontend Web Development

A front end (client-side) is a website that a user can see and interact with. It can be also called a client-side because it is the part that the user(client) can see and interact with. Therefore, anything we see on any website when we surf on the internet is part of the front end and it includes the colors, fonts, buttons, images, videos, audios and any other content on the website.The technologies that uses to build front end parts of a website are called front end technologies. The core technologies to build a front end are:

  • HTML
  • CSS
  • JavaScript

There are hundreds of JavaScript that allows building a dynamic web applications. Currently, the three most popular JavaScript libraries are:

  • React
  • Vue
  • Angular

Backend Web Development

Backed(Server-side) development refers to the activities that happens behind the scene. Backend development consists of backend a programming language and a database. The backend interacts with frontend and the database using a backend programming language that could be (Node.js, Python, Ruby, PHP, etc). Look at the following figure to understand the interaction between client. A client send a HTTP request to the backend and the backend return a HTTP response to the client computer(The response could be an HTML page, txt, image, or any other form of data). HTTP(Hypertext Transfer Protocol) is a communication protocol that allow transmitting data between a client and a sever. It is designed for communication between web browsers(client) and web servers.

img

Credit to Asabeneh

Day 02

What is HTML?

HTML is an acronym, that it stands for Hypertext Markup Language .

HTML Element

HTML elements consists of an open tag <>, attribute(s), content and closing tag <>. Below is a demo.

<tag>Content</tag>

<h1>Welcome to 30 Days of HTML</h1>

The tag name is h1 and the content is 30 Days of HTML. The h1 will tell the browser to make the text a big font size, that’s why we call HTML a markup language.

<p>
  HTML elements are the blocking of a website. There is not website without
  HTML. Learn HTML and build a website.
</p>

The p tag marks the text to be paragraph.

Attribute

HTML attributes provide additional information about the element. An attribute can added only in the opening tag. It will be difficult to list down all HTML attributes but we can list down the most common ones.

  • alt - to add information about added image, use with img element.
  • autocompelete - to enable auto complete feature of a form, use with form and input.
  • autofocus - enable auto focus of input fields
  • autoplay - allows playing an audio/video on the page loads
  • charset - enable character encoding of meta tag
  • checked - to make a checkbox checked of an input element
  • class - to give a common identifier for HTML elements
  • cols - to determine the width of a textarea element
  • contenteditable - make any element editable
  • download - allows a link to download a resource(image, pdf, PPT, etc)
  • draggable - to make an element draggable, apply to all elements
  • for - to connect/bound a label element with a specific input field, use with a label tag
  • href - to specify a URL or a path of a resource, use with a link tag
  • id - a unique id for an HTML element, apply to all elements
  • lang - specifies the language of the page
  • type - specifies the type of the element and it uses with only a certain elements
  • src - to specify URL of a media file(img, audio, video, source, embed, script)
  • style - to add an inline CSS style to an element

There are also event listener attribute that listen mouse or keyboard. For instance, onclick, onsubmit, onkeydown, onkeyup, onscroll, etc. Remember, do not try to remember by hard. For detail information about, HTML attributes you may check this link.

<p style="color:gray;">
  HTML elements are the blocking of a website. There is not website without
  HTML. Learn HTML and build a website.
</p>

The above p tag has a style attribute. The style attribute has a color property and a value gray. The style changes the text color to gray. You can try it by adding other property and value in the style. Each value has to be separated by a semicolon.

Some HTML elements do not have closing tag, instead they have self-closing tag.

An example of self closing tags:

<area />
<base />
<br />
<col />
<embed />
<hr />
<img />
<input />
<link />
<meta />
<para />
<source />
<track />
<wbr />

The slash is optional but I strongly recommend to use the slash with self-closing tags. For instance, React.js does not allow you to use without the slash.

HTML Comment

Comment in any programming language help a code to be more readable. Therefore, it is common to leave some text on a code to make it more readable and maintainable. Let us the syntax of an HTML comment, it has opening ()

<!-- The is an HTML comment and it makes the code more readable -->

Day02 Exercise

  • What is the acronym HTML stands for?
    • Hypertext Markup Language
  • What is an HTML element?
    • Element consists of a <> attribute(s) content </>
  • What is an attribute
    • Attribute can provide additional information about the element
  • Write at least five HTML attributes
    • style
    • alt
    • src
    • type
    • class
  • Where do you write an attribute to HTML element?
    • In the former <>
  • Write an HTML comment that says, I am enjoying 30 Days of HTML
    • <p>I am enjoying 30 Days of HTML</p>
  • What is the purpose of Visual studio code?
    • An IDE, a code editor
  • What is the purpose of the browser?
    • Browser render your HTML code to a human read website
  • Does every element need to have attributes?
    • Not necessarily

Day 03

DOM

DOM stands for Document Object Model. The DOM is structure like a tree. It starts with an html root element followed by head and body. The head and the body are the immediate children of the root element, html. Before the root element, there is a declaration.

Declaration

Before the root element, there is a declaration. This declaration tells the browser that the document is an HTML. Therefore, the browser render it to the way an HTML suppose to be rendered.

This is the code to declare an HTML. The declaration is not part of the DOM tree.

<!DOCTYPE html>

Root Element

The html element is the root of the DOM tree and is the parent of head and body.

The DOM tree has to be wrapped by the html tag.

The html tag with two children, head and body.

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    content goes here
  </body>
</html>

his a simplistic DOM structure that contains html, head, title, body, h1 elements.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <h1 id="first-title">The Building Blocks of the web</h1>
  </body>
</html>

The DOM tree of the above HTML looks like the following diagram.

DOM tree

Heading Elements

HTML is a markup language. We mark a content using an HTML tag and the browser render it to a clean web page. The h1 tag means making a text to be a large font size text, by default it creates 32px size text. We have h1 to h6 different tags to write different font size title. Pixel(px) is a unit to measure size which is as small as a dot.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <h1>First level heading</h1>
    <h2>Second level heading</h2>
    <h3>Third level heading</h3>
    <h1>Fourth level heading</h1>
    <h4>Fifth level heading</h4>
    <h6>Sixth level heading</h6>
  </body>
</html>

The size of the h1 to h6 tags:

  • h1 is 32px (2em)
  • h2 is 24px (1.5em)
  • h3 is 20.8px (1.3em)
  • h4 is 16px (1em)
  • h5 is 12.8px (0.8em)
  • h6 is 11.2px (0.7em)

Paragraph Element

Now, let’s add paragraph to our web page using the p tag.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <h1 id="first-title">The Building Blocks of the web</h1>
    <p>
      There is not website without HTML. Learn HTML and build websites and web
      applications
    </p>
  </body>
</html>

Now, there are six elements in the above HTML code. An HTML element may have a parent, a child, sibling(s). The html element is the root or the parent of the head and body. The head and body are children of the htmltag.The head and body are siblings. The title is the child of the head. The body has two children, the h1 and p.

Section Element

If we went to create section for our page, we can use div or section element. Section element has semantic meaning. Let’s add div in the previous page.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <div>
      <h1 id="first-title">The Building Blocks of the web</h1>
      <p>
        There is not website without HTML. Learn HTML and build websites and web
        applications
      </p>
    </div>
  </body>
</html>

As you can see from the above code, all the elements inside the body are wrapped by a div. Instead of div, a section can be also used

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <section>
      <h1 id="first-title">The Building Blocks of the web</h1>
      <p>
        There is not website without HTML. Learn HTML and build websites and web
        applications
      </p>
    </section>
  </body>
</html>

Header Section

Now, let us add header to our web page using the header HTML tag.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>HTML</header>
    <section>
      <h1 id="first-title">The Building Blocks of the web</h1>
      <p>
        There is not website without HTML. Learn HTML and build websites and web
        applications
      </p>
    </section>
  </body>
</html>

Inside the header, we can add any kind of HTML element. But I like to style the four letters of the HTML text. Therefore, I have to tag them in span element.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span>H</span>
      <span>T</span>
      <span>M</span>
      <span>L</span>
    </header>
    <section>
      <h1 id="first-title">The Building Blocks of the web</h1>
      <p>
        There is not website without HTML. Learn HTML and build websites and web
        applications
      </p>
    </section>
  </body>
</html>

Main Section

Let’s make use of the main HTML tag to wrap all the content that will go to the main section.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span>H</span>
      <span>T</span>
      <span>M</span>
      <span>L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <p>
          There is not website without HTML. Learn HTML and build websites and
          web applications
        </p>
      </section>
    </main>
  </body>
</html>

Foot Section

There is a footer HTML tag to make a footer. Let us create footer for the web page.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span>H</span>
      <span>T</span>
      <span>M</span>
      <span>L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <p>
          There is not website without HTML. Learn HTML and build websites and
          web applications
        </p>
      </section>
    </main>
    <footer>Copyright 2022 | Landisland</footer>
  </body>
</html>

Instead of just throwing text in the footer tag let us add a small HTML tag to wrap the text and it will be render to a small size text.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span>H</span>
      <span>T</span>
      <span>M</span>
      <span>L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <p>
          There is not website without HTML. Learn HTML and build websites and
          web applications
        </p>
      </section>
    </main>
    <footer>
      <small>Copyright 2022 | Landisland</small>
    </footer>
  </body>
</html>

Inline Style

We can apply CSS to an HTML element using inline styling. Look at the figure below

HTML

We use the style attribute to apply CSS to an HTML element. For instance, let us apply style to h1.

<h1 id="first-title" style="color:green">The Building Blocks of the web</h1>

We can add more CSS properties by separating with semicolons

<h1 id="first-title" style="color:green;font-size:90px; background:blue;">
  The Building Blocks of the web
</h1>

As you can see from above code, font-size and background properties have been used.

Similarly let us apply style to the span elements.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span style="color: #e34c26">H</span>
      <span style="color: #264de4">T</span>
      <span style="color: #f0db4f">M</span>
      <span style="color: #61dbfb">L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <p>
          There is not website without HTML. Learn HTML and build websites and
          web applications
        </p>
      </section>
    </main>
    <footer>
      <small>Copyright 2022 | Landisland</small>
    </footer>
  </body>
</html>

Colors can be described by name, hexadecimal, RGB(Red, Green, Blue), and HSL(Hue, Saturation, Lightness).

There about 1.67 million colors and it hard to describe them by name. There are about 140 colors that can be described by name and the rest of the colors can be described using hexadecimal, RGB, or HSL. One form of the color can be converted the other. Let see the different form of the color red(name), hexadecimal(#ff0000), RGB(rgb(255, 0, 0)) and HSL(hsl(0, 100%, 50%))

If you followed all the steps by now you should get something like this.

Simple web page

Day 03 Exercise

  • What is the acronym DOM stands for?
    • Document Object Model
  • What is the root of the DOM tree?
    • html element
  • What are the children of html tag
    • head and body
  • How many children can the head have?
    • A lot
  • How many children can the body have?
    • A lot
  • Make a DOM tree of the following HTML code
<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span style="color: #e34c26">H</span>
      <span style="color: #264de4">T</span>
      <span style="color: #f0db4f">M</span>
      <span style="color: #61dbfb">L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <p>
          There is not website without HTML. Learn HTML and build websites and
          web applications
        </p>
      </section>
    </main>
    <footer>
      <small>Copyright 2021 | Asabeneh Yetayeh</small>
    </footer>
  </body>
</html>
  • html
    • head
      • title
    • body
      • header
        • span
      • main
        • section
          • h1
          • p
      • footer
        • small

Day 04

Blocking and Non-blocking Elements

HTML elements are like a box. Some elements take the whole width of the view port while some take as much space that fit only for the content. In another way, some elements do not allow other elements to come next them both in the left and right side, however, some elements allow other elements to come next to them.

  • Blocking elements take the whole width of the viewport.
  • Non-blocking element only take a space that is enough for the content.

List of blocking elements:

<address></address> - allows to write an address related information
<article></article> - allows to write articles in a section
<aside></aside> - allows to create a section that is indirectly related to the document
<blockquote></blockquote> - to create text a quoation mark
<canvas></canvas> - to create canbas
<dd></dd> - to describe a term or name in a description list
<div></div> - to create section or box
<dl></dl> - to create a description list
<dt></dt> - describes a term a description list
<fieldset></fieldset> - to create related elements in a from
<figcaption></figcaption> - define figure caption
<figure></figure> - to wrap figure, diagram, etc
<footer></footer> - to create footer of a document
<form> - to create a form
<h1></h1> to <h6></h6> - to create different size headings
<header></header> - to create header of a document
<hr /> - to create a horizontal line
<li></li> - create order or an unordered list
<main></main> - to wrap the main content of the document
<nav><nav> - to create navigation
<noscript></noscript> - describe an alternative content to be displayed to users when JS has disabled on their browsers.
<ol></ol> - to create an ordered list
<p></p> - to creat paragraph
<pre></pre> - to create a space preserved content, eg poem
<section><section> - to create section
<table></table> - to create table
<tfoot><tfoot> - to create a table footer
<ul><ul> - to wrap order or unorder list
<video></video> - to create a video content

Now, let’s use some of the blocking elements in following snippet of code.

<!DOCTYPE html>
<html>
  <head>
    <title>30 Days Of HTML</title>
  </head>
  <body>
    <header>
      <span style="color: #e34c26">H</span>
      <span style="color: #264de4">T</span>
      <span style="color: #f0db4f">M</span>
      <span style="color: #61dbfb">L</span>
    </header>
    <main>
      <section>
        <h1 id="first-title">The Building Blocks of the web</h1>
        <article>
          <p>
            There is not website without HTML. Learn HTML and build websites and
            web applications
          </p>
        </article>
      </section>

      <section>
        <h2>Front end Technologis</h2>
        <ul>
          <li>HTML</li>
          <li>CSS</li>
          <li>JavaScript</li>
        </ul>
      </section>
      <section>
        <video src="./assets/video/js-project.mp4"></video>
      </section>
    </main>
    <footer>
      <small>Copyright 2021 | Asabeneh Yetayeh</small>
    </footer>
  </body>
</html>

List of non-blocking elements

<a> - to create a link
<abbr> - to create abbreviation
<acronym> - to create an acronym
<audio> - to create or embed an audio
<b> - to make bold
<bdo> - to reverse a text
<big> - to make text big
<br> - to make a line break
<button> - to create a button
<cite> - to add citation
<code> - to write code on HTML
<dfn> - to write definition using HTML
<em> - to make an emphasise
<i> - to make italic
<img> - to create an image
<input> - to create an input field
<kbd> - to define keyboard inputs
<label> - to create a label for input fields
<map> - to define an image map
<object> - to represent an external resource that used to multimedia such as audios, videos, images, pdf, etc
<output> - to represent a result of a calculation
<q> - short quotation
<samp> - to represent sample output
<script> - to write JS code
<select> - to select items
<small> - to write small size texts
<span> - to mark or separate a text
<strong> - to make text with strong importance
<sub> - to create subscript
<sup> - to make superscript
<textarea> - to create a text area
<time>- represents a specific period of time
<tt> - to represent inline teletype
<var> - is used to define a variable

Day 04 Exercise

  • What is blocking element?
    • Blocking element takes the whole width of the viewport
  • What is non-blocking element?
    • Non-blocking element only take a space that is enough for the content
  • What is the difference between block and non-blocking elements?
  • List at least five blocking elements
    • div
    • main
    • h1
    • nav
    • blockquote
  • List at least five non-blocking elements
    • button
    • img
    • q
    • small
    • time

Day 05 HTML Formatting Elements

We format text in different form on daily basis. Every Microsoft office users know how to format a text on Microsoft office document. Similarly, we can format text on a web using different HTML elements.

HTML Formatting Elements

- <b> - Create bold text
- <strong> - Make an important text
- <i> -  Make italic text
- <em> -  Make emphases to text
- <mark> - Marks text
- <small> - Make smaller text
- <del> - Deleted text
- <ins> - Inserted text
- <sub> - Subscript text
- <sup> - Superscript text
- <pre> - Preserve text space
- <u> -To underline