What is HTML?
First developed by Tim Berners-Lee in 1990. HTML is used to create electronic documents (called pages) that are displayed on the World Wide Web. Each page contains a series of connections to other pages called hyperlinks. Every web page you see on the Internet is written using one version of HTML code or another.
HTML code ensures the proper formatting of text and images so that your Internet browser may display them as they are intended to look. Without HTML, a browser would not know how to display text as elements or load images or other elements. HTML also provides a basic structure of the page, upon which Cascading Style Sheets are overlaid to change its appearance. One could think of HTML as the bones (structure) of a web page, and CSS as its skin (appearance).
HTML is a language for describing web pages.
- HTML stands for Hyper Text Markup Language
- HTML is not a programming language, it is a markup language
- A markup language is a set of markup tags
- HTML uses markup tags to describe web pages
- HTML is easy to learn
Example
<!DOCTYPE html>
<html>
<body>
<h1>Write Heading</h1>
<p>Write Code.</p>
</body>
</html>
<html>
<body>
<h1>Write Heading</h1>
<p>Write Code.</p>
</body>
</html>
HTML Element Syntax
- An HTML element starts with a start tag / opening tag
- An HTML element ends with an end tag / closing tag
- The element content is everything between the start and the end tag
- Some HTML elements have empty content
- Empty elements are closed in the start tag
- Most HTML elements can have attributes
HTML Headings
Headings are defined with the <h1> to <h6> tags.<h1> defines the largest heading.
<h6> defines the smallest heading.
Example
<h1>This is a heading </h1>
<h2>This is a heading </h2>
<h3>This is a heading </h3>
Note: Browsers automatically adds an empty line before and after headings.
Headings Are Important
Use HTML headings for headings only.
Don't use headings to make text BIG or bold.
Search engines use your headings to index the structure and content of your web pages.
Since users may skim your pages by its headings, it is important to use headings to show the document structure.
H1 headings should be used as main headings, followed by H2 headings, then less important H3 headings, and so on.
HTML Rules (Lines)
The <hr/> tag is used to create an horizontal rule (line).Example
<h1> This is a heading </h1>
<h2> This is a heading </h2>
<h3> This is a heading </h3>
Note: Browsers automatically adds an empty line before and after headings.
<h2> This is a heading </h2>
<h3> This is a heading </h3>
Note: Browsers automatically adds an empty line before and after headings.
HTML Paragraphs
Paragraphs are defined with the <p> tag.
Example
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Note: Browsers automatically adds an empty line before and after paragraphs.
Don't Forget the End Tag
Most browsers will display HTML correctly even if you forget the end tag:
Example
<p>This is a paragraph
<p>This is another paragraph
The example above will work in most browsers, but don't rely on it. Forgetting the end tag can
produce unexpected results or errors.
Note: Future version of HTML will not allow you to skip end tags.
HTML Line Breaks
Use the <br /> tag if you want a line break (a new line) without starting a new paragraph:
Example
<p>This is<br />a para<br />graph with line breaks</p>
The <br /> element is an empty HTML element. It has no end tag.
<br> or <br />
In XHTML, XML, and future versions of HTML, HTML elements with no end tag (closing tag)
are not allowed.
Even if <br> works in all browsers, writing <br /> instead is more future proof.
HTML Output - Useful Tips
You cannot be sure how HTML will be displayed. Large or small screens, and resized windows
will create different results.
With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML
code.
The browser will remove extra spaces and extra lines when the page is displayed.
Any number of lines count as one space, and any number of spaces count as one
space.
0 comments :
Post a Comment