HTML5
HTML5
What is HTML5?
HTML stands for Hyper Text Markup Language, it is easy and fun to learn.
standard.
It is essential to learn HTML if you want to build web sites, you can't build one if you don't know HTML
because it's one of the prerequisites in learning other languages used for web development.
For you to learn faster and see how our examples would actually look like simlarly on a real browser we
have implemented a simple Try it Yourself Editor with syntax highlighting where you can play and
experiment with the example codes given.
Example:
Reselt:
This is a heading
Example Explained
★ <html> : this element encloses everything inside of an html document; it includes tags, elements,
style sheets, scripts, text, multimedia and a lot more
★ <head>: this element encloses the metadata of a document which will not be displayed on the main
content of a web page; this could include style sheets, scripts, <title>, <meta> tags and a lot more
★ <title> this element defines the title of a web page; it appears on the upper-part of a browser
★ <body> this element encloses elements like <h1>, <p>, <img>, <b>, <i> and a lot more
★ <h1> this element defines a heading <p>: this element defines a paragraph
HTML Tags
brackets. In HTML we start and end tags. Look at the example below.
<p>
</p>
You can use a text editor! Creating HTML files is completely free, and you don't need to download
expensive applications. Take a look at the list below for some free apps you could use to edit HTML files:
- Notepad
- Notepad++
- TextEdit
- VIM
- ATOM
- Brackets
- This app! We offer a micro code-editor with syntax highlighting that can save and open HTML files.
These are among the most commonly used text editors for creating HTML files. You have the freedom to
download any application you prefer.
It's important to save your HTML files with the .html file extension, such as "mywebpage.html". If you
don't use the .html extension, your files won't be compatible with web browsers.
<p> Hello World! </p>
5. Click SAVE.
HTML Elements
In the first lesson we have studied about tags and things like start tag (opening a tag) and end tag
An HTML element is usually composed of a "Start Tag", "Element Content" and an "End Tag".
Example:
There are some cases that an HTML element can contain one or more HTML elements.
The example nested HTML Elements above are composed of the following:
On the example above, there are two start tags and two end tags.
★ <meta />
★ <link />
★ <img />
★ <br />
★ <hr />
★ <input />
The best practice in HTML Empty Elements is to always put a forward slash / sign before the greater
than > sign.
• HTML attributes only appear at start tags. It will never be on end tags.
• There are some attributes that can be used on all HTML Elements though they may not have effects on
some elements. They are called Global Attributes. Click for an example.
⚫ an attribute name
⚫ an equal sign
You can also use single quotation marks depending on the situation esp. when the value contains double
quotes.
We will only use double quotation marks throughout the entire tutorial.
In this lesson we are going to learn some HTML Attributes with examples.
Links are defined using the anchor <a> element. On the example above we used the href attribute to tell
the browser where to go.
values/names.
The id 's value should be unique for each element. These help us select elements in style sheets and
scripts.
HTML Comments
HTML Comments
HTML comments are text, phrases or sentences inside an HTML file. They are only shown in codes and
not rendered by a browser.
HTML comments help both beginners and experienced web developers to easily organize their codes.
Example:
HTML Styles
HTML Styles
HTML Styles are used to style HTML elements it also means changing default values. For instance, styling
can change the default values of text color as black, background color as white, text alignment as left
and text size as 12 pixels.
Using an internal style sheet is also called internal styling. An Internal Style Sheet is composed of one or
more Cascading Style Sheet (CSS) rule-set.
A CSS rule-set consists of a selector and a declaration. block surrounded by curly braces that contains
one or more CSS declarations separated by semicolons. Each declaration includes a CSS property name
and a value, separated by a colon.
They are all enclosed inside the <style> element with its type="text/css" attribute which is included
inside the <head> element.
In this lesson we will use inline styling with CSS properties color and background-color to change the
text color and/or background color of HTML Elements.
• Color Name. It defines any valid color by its color name e.g. white, black.
• Hex Color Value. Or Hexadecimal Color Value. It defines any valid color by a hash followed by letters
and/or numbers e.g. #ffffff, #000000 . • RGB Color Value. RGB stands for Red, Green, Blue.
It defines any valid color by this format "rgb(number, number, number) "e.g. rgb(255, 255, 255),
rgb(0, 0, 0). The numbers represent the intensity of the red, green and blue colors in that particular
order.
Example:
Most Common HTML Colors
As Background
As Text