diff --git a/images/DOM-tree.png b/images/DOM-tree.png new file mode 100644 index 0000000..eeab2d9 Binary files /dev/null and b/images/DOM-tree.png differ diff --git a/images/html-inline-style.png b/images/html-inline-style.png new file mode 100644 index 0000000..5959d6f Binary files /dev/null and b/images/html-inline-style.png differ diff --git a/images/simple-web-page-1.png b/images/simple-web-page-1.png new file mode 100644 index 0000000..418103c Binary files /dev/null and b/images/simple-web-page-1.png differ diff --git a/readme.md b/readme.md index d95eac7..d5fcb04 100644 --- a/readme.md +++ b/readme.md @@ -27,8 +27,20 @@ - [Exercise](#exercise) - [Day 3](#day-3) - [DOM](#dom) - - [Block Elements](#block-elements) + - [Heading Elements](#heading-elements) + - [Paragraph Element](#paragraph-element) + - [Section Element](#section-element) + - [Header Section](#header-section) + - [Main Section](#main-section) + - [Footer Section](#footer-section) + - [Inline Style](#inline-style) + - [Exercise](#exercise-1) +- [Day 4](#day-4) + - [Blocking and Non-blocking Elements](#blocking-and-non-blocking-elements) +- [Day 5](#day-5) - [HTML5 Semantic Elements](#html5-semantic-elements) +- [Day 5](#day-5-1) + - [HTML5 Semantic Elements](#html5-semantic-elements-1) | # Day | Topics | | ----- | :----------------------------: | @@ -354,6 +366,376 @@ Comment in any programming language help a code to be more readable. Therefore, ## DOM -## Block Elements +In this section, we will start writing the DOM tree of an HTML document or file. DOM stands for Document Object Model. The DOM is structure like a true. 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_. +Create folder on the desktop and give it any name and even you may call it (30DaysOfHTML), inside this folder create an index.html file. Every HTML file has to end with .html extension. And it is good to have at least on index.html file in the project and the reset of the file will have different names. + +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. + +```html + +``` + +This a simplistic DOM structure that contains _html_, _head_, _title_, _body_, _h1_ elements. + +```html + + + + 30 Days Of HTML + + +

The Building Blocks of the web

+ + +``` + +The DOM tree of the above HTML looks like the following diagram. + +![DOM tree](images/DOM-tree.png) + +### 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. + +```html + + + + 30 Days Of HTML + + +

First level heading

+

Second level heading

+

Third level heading

+

Fourth level heading

+

Fifth level heading

+
Sixth level heading
+ + +``` + +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. + +```html + + + + 30 Days Of HTML + + +

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and web + applications +

+ + +``` + +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 _html_ tag.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. + +```html + + + + 30 Days Of HTML + + +
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and web + applications +

+
+ + +``` + +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 + +```html + + + + 30 Days Of HTML + + +
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and web + applications +

+
+ + +``` + +### Header Section + +Now, let us add header to our web page using the _header_ HTML tag. + +```html + + + + 30 Days Of HTML + + +
HTML
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and web + applications +

+
+ + +``` + +In side 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. + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and web + applications +

+
+ + +``` + +### Main Section + +Let's make use of the _main_ HTML tag to wrap all the content that will go to the main section. + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and + web applications +

+
+
+ + +``` + +### Footer Section + +There is a _footer_ HTML tag to make a footer. Let us create footer for the web page. + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and + web applications +

+
+
+ + + +``` + +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. + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and + web applications +

+
+
+ + + +``` + +### Inline Style + +We can apply CSS to an HTML element using inline styling. +Look at the figure below +![HTML](./images/html-inline-style.png) + +We use the _style_ attribute to apply CSS to an HTML element. +For instance, let us apply style to h1. + +```html +

The Building Blocks of the web

+``` + +We can add more CSS properties by separating with semicolons + +```html +

+ The Building Blocks of the web +

+``` + +As you can see from above code, _font-size_ and _background_ properties have been used. + +Similarly let us apply style to the _span_ elements. + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and + web applications +

+
+
+ + + +``` + +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](./images/simple-web-page-1.png) + +Congratulations! You have completed Day 3 challenge + +## Exercise + +Make a DOM tree of the following HTML code + +```html + + + + 30 Days Of HTML + + +
+ H + T + M + L +
+
+
+

The Building Blocks of the web

+

+ There is not website without HTML. Learn HTML and build websites and + web applications +

+
+
+ + + +``` +# Day 4 + +## Blocking and Non-blocking Elements + +# Day 5 + +## HTML5 Semantic Elements + +# Day 5 ## HTML5 Semantic Elements