HTML

From Wikipedia, the free encyclopedia
Jump to: navigation, search
HTML
(HyperText Markup Language)
File extension: .html, .htm
MIME type: text/html
Type code: TEXT
Uniform Type Identifier: public.html
Developed by: World Wide Web Consortium & WHATWG
Type of format: Markup language
Extended from: SGML
Extended to: XHTML
Standard(s): ISO/IEC 15445
W3C HTML 4.01
W3C HTML 5 (draft)

HyperText Markup Language (HTML) is a markup language for creating webpages. Webpages are usually viewed in a web browser. They can include writing, links, pictures, and even sound and video. HTML is used to mark and describe each of these kinds of content so the web browser can show them correctly.

HTML can also be used to add meta information to a webpage. Meta information is information about the web page. For example, the name of the person who made it. Meta information is not usually shown by web browsers.

Cascading Style Sheets (CSS) and JavaScript can be included in HTML code. CSS is used to change how a webpage looks. JavaScript is used to add features to webpages and make them more interactive.

HTML was made by the World Wide Web Consortium (W3C). There are many versions of HTML. The current standard is HTML 4.01. So, it is the version the W3C recommends. A newer version, called HTML5, will become standard within the next few years. The W3C also develops XHTML. This is another markup language which is very similar to HTML, but more strict.

Tags[change | change source]

HTML uses special bits of programming language called "tags" to let the browser know how a webpage should look. The tags usually come in pairs: an opening tag to tell the browser when to start doing something, and an ending tag to tell the browser when to stop doing something. There are many different kinds of tags, and each one has a different purpose.

Opening tags have a keyword, such as "p," surrounded by angle brackets (< and >). For example, the tag <p> tells the browser the start a new paragraph. Ending tags look almost exactly the same, only they have a forward slash (/) added just before the keyword. For example, the tag </p> tells the browser to end a paragraph. A small number of tags, like <br> and <hr>, can be used without an ending tag.

Some tags only work in certain browsers. For example, the <marquee> tag, which is used to make a bit of writing slide across the page, only works in the Internet Explorer and Mozilla Firefox browsers. Other browsers simply ignore this tag and display the writing normally. Many web page creators avoid using these "non-standard" tags because they want their pages to look the same with all browsers.

Example[change | change source]

Here is an example page in HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>This is the title of the page.</title>
  </head>
  <body>
    <p>This is a paragraph.</p>
  </body>
</html>

HTML5[change | change source]

The W3C is making a new version of HTML, called HTML5, with more features and better support for things like online video. HTML5 is expected to become the standard version of HTML within the next few years.

Some of the new features in HTML5 are:

  • The <canvas> tag which can be used with JavaScript to draw 2D pictures and animations.
  • A <video> tag for adding videos to a webpage.
  • A <audio> tag for adding audio, like music or sound effects, to a webpage.
  • Tags for marking common kinds of content, including: <article>, <footer>, <header>, <nav>, <progress>, <section>, <summary>, <time>

In addition, some features of HTML4 have been left out of HTML5. For example, the <font> tag, which is used to change how text looks on a page, is not available in HTML5. The W3C recommends doing this with CSS instead.

One of the aims of HTML5 is to remove the need to use third-party software like Adobe Flash, because it is often slow on mobile devices like phones and can be used to infect your computer with viruses. Another aim is to reduce the amount of program code (JavaScript) running in each webpage, thus making the web faster.

Currently, no browsers completely support all of HTML5's new features. However, some of the features are supported by Mozilla Firefox, Google Chrome and Apple Safari.

Incomplete list of HTML tags[change | change source]

Tag name What it does How it works
<!-- --> creates a hidden comment <!-- hidden comment -->
<!DOCTYPE> tells the type of document <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<a> Creates active links to other web pages <a href="http://www.google.com/" title="title of page" class="CSS class" id="CSS identifier" style="CSS expression">text to display</a>
<abbr> Creates an abbreviation <abbr title="this is an example abbreviation">example of</abbr>
<b> Creates bold text   <b>bold text</b>

  Also accepts class, style, and id parameters.

<i> Creates slanted italicized text   <i>italicized text</i>
text here<br /> Breaks (wraps) a line of text   <br />wrapped text here.
<s> Creates a line through text   <s>line through text</s>
<u> Underlines words and sentences.   <u>Underlined text</u>
<H1> Changes the font of a word to 24   <H1> FONT 24</H1>
<H2> Changes the font of a word to 18   <H2> FONT 18</H2>
<H3> Changes the font of a word to 14   <H3> FONT 14</H3>
<H4> Changes the font of a word to 12   <H4> FONT 12</H4>
<H5> Changes the font of a word to 10   <H5> FONT 10</H5>
<H6> Changes the font of a word to 7   <H6> FONT 7</H6>
<script> Creates a script in the webpage   <script>document.write("Hello World!")</script>
<table> Creates a table   <table><tr> <td>10</td> <td>20</td> </tr><tr> <td>30</td> <td>40</td> </tr></table>
<tr> Creates a table row   <table><tr> <td>10</td> <td>20</td> </tr><tr> <td>30</td> <td>40</td> </tr></table>
<td> Creates a table cell   <table><tr> <td>10</td> <td>20</td> </tr><tr> <td>30</td> <td>40</td> </tr></table>
<span> Used to add attributes to a part of text or to allow CSS and Javascript to specify that part of the document.   <span>Lorem ipsum <span class='highlight'>dolor sit amet</span>, consectetur adipiscing elit.</span>

Other websites[change | change source]