What is HTML? HTML is the standard markup language for creating Web pages. HTML is a fairly simple language made up of elements, which can be applied to pieces of text to give them different meaning in a document (is it a paragraph? is it a bulleted list? is it part of a table?), structure a document into logical sections (does it have a header? three columns of content? a navigation menu?) and embed content such as images and videos into a page. This module will introduce the first two of these, and introduce fundamental concepts and syntax you need to know to understand HTML. HTML stands for Hyper Text Markup Language HTML describes the structure of Web pages using markup HTML elements are the building blocks of HTML pages HTML elements are represented by tags HTML tags label pieces of content such as "heading", "paragraph", "table", and so on Browsers do not display the HTML tags, but use them to render the content of the page WHY LEARN HTML? It is possible to create webpages without knowing anything about the HTML source behind the page. There are excellent editors on the market that will take care of the HTML parts. All you need to do is layout the page. However, if you want to make it above average in webdesign, it is strongly recommended that you understand these tags. The most important benefits are: You can use tags the editor does not support.
You can read the code of other people's pages, and "borrow" the cool effects. You can do the work yourself, when the editor simply refuses to create the effects you want. You can write your HTML by hand with almost any available text editor, including notepad that comes as a standard program with Windows. All you need to do is type in the code, then save the document, making sure to put an.html extension or an.htm extension to the file (for instance "mypage.html"). TAGS Basically, a computer sees an "A" as simply an "A" - whether it is bold, italic, big or small. To tell the browser that an "A" should be bold we need to put a markup in front of the A. Such a markup is called a Tag. All HTML tags are enclosed in < and >. HTML: the HTML for the above example: This is an example of <b>bold</b> text. HTML tags normally come in pairs like <p> and </p> The first tag in a pair is the start tag, the second tag is the end tag The end tag is written like the start tag, but with a forward slash inserted before the tag name
HTML Tags Ordered Alphabetically List: Title The title of a document is given between title tags: <TITLE>... </TITLE> The text between the opening and the closing tags is a title for the hypertext node. There should only be one title in any node. It should identify the content of the node in a fairly wide context, and should ideally fit on one line. The title is not strictly part of the text of the document, but is an attribute of the node. It may not contain anchors, paragraph marks, or highlighting. the title may be used to identify the node in a history list, to label the window displaying the node, etc. It is not normally displayed in the text of a document itself. Contrast titles with headings. Next ID Obsolete: NeXT Browser only. May be ignored. This tag takes a single attribute which is the number of the next document-wide numeric identifier to be allocated (not good SGML). Note that when modifying a document, old anchor ids should not be reused, as there may be references stored elsewhere which point to them. This is read and generated by hypertext editors. Human writers of HTML usually use mnemonic alpha identifiers. Browser software may ignore this tag. Example of use: <NEXTID 27> Base Address Anchors specify addresses of other documents, in a from relative to the address of the current document. Normally, the address of a document is known to the browser because it was used to access the document. However, is a document is mailed, or is somehow visible with more than one address (for example, via its filename and also via its library name server catalogue number), then the browser needs to know the base address in order to correctly deduce external document addresses. The format of this tag is not yet specified. NOT CURRENTLY USED
Anchors The format of an anchor is as follows: <A NAME=xxx HREF=XXX>... </A> The text between the opening tag and the closing tag is either the start or destination (or both) of a link. Attributes of the anchor tag are as follows. HREF If the HREF attribute is present, the anchor is senstive text: the start of a link. If the reader selects this text, he should be presented with another document whose network address is defined by the value of the HREF attribute. The format of the network address is specified elsewhere. This allows for the form HREF=#identifier to refer to another anchor in the same document. If the anchor is in another document, the atribute is a relative name, relative to the documents address (or specified base address if any). NAME The attribute NAME allows the anchor to be the destination of a link. The value of the parameter is that part of a hypertext address which follows the hash sign. TYPE An attribute TYPE may give the relationship described by the hyertext link. The type is expressed by a string for extensibility. Strings for types with particular semantics will be registered by the W3 team. The default relationship if none other is given is void. All attributes are optional, although one of NAME and HREF is necessary for the anchor to be useful. IsIndex This tag informs the reader that the document is an index document. As well as reading it, the reader may use a keyword search. Format: <ISINDEX> The node may be queried with a keyword search by suffixing the node address with a question mark, followed by a list of keywords separated by plus signs. See the network address format.
Plaintext This tag indicates that all following text is to be taken litterally, up to the end of the file. Plain text is designed to be represented in the same way as example XMP text, with fixed width character and significant line breaks. Format: <PLAINTEXT> This tag allows the rest of a file to be read efficiently without parsing. Its presence is an optimisation. There is no closing tag. Example sections These styles allow text of fixed-width characters to be embedded absolutely as is into the document. The format is: <LISTING>... </LISTING> The text between these tags is to be portrayed in a fixed width font, so that any formatting done by character spacing on successive lines will be maintained. Between the opening and closing tags: The text may contain any ISO Latin printable characters, including the tag opener, so long as it does not contain the closing tag in full. Line boundaries are significant, and are to be interpreted as a move to the start of a new line. The ASCII Horizontal Tab (HT) character should be interpreted as the smallest positive nonzero number of spaces which will leave the number of characters so far on the line as a multiple of 8. Its use is not recommended however. The LISTING tag is portrayed so that at least 132 characters will fit on a line. The XMP tag is portrayed in a font so that at least 80 characters will fit on a line but is otherwise identical to LISTING. The examples of markup are here given using the XMP tag. Paragraph This tag indicates a new paragraph. The exact representation of this (indentation, leading, etc) is not defined here, and may be a function of other tags, style sheets etc. The format is simply <P> (In SGML terms, paragraph elements are transmitted in minimised form).
Headings Several levels (at least six) of heading are supported. Note that a hypertext document tends to need less levels of heading than a normal document whose only structure is given by the nesting of headings. H1 is the highest level of heading, and is recommened for the start of a hypertext node. It is suggested that the first heading be one suitable for a reader who is already browsing in related information, in contrast to the title tag which should identify the node in a wider context. <H1>, <H2>, <H3>, <H4>, <H5>, <H6> These tags are kept as defined in the CERN SGML guide. Their definition is completely historical, deriving from the AAP tag set. A difference is that HTML documents allow headings to be terminated by closing tags: <H2>Second level heading</h2> Address This tag is for address information, signatures, etc, normally at the top or bottom of a document. typically, it is italic and/or right justified or indented. The format is: <ADDRESS> text... </ADDRESS> Highlighting The highlighted phrase tags may occur in normal text, and may be nested. For each opening tag there must follow a corresponding closing tag. NOT CURRENTLY USED. <HP1>...</HP1> <HP2>... </HP2> etc. Glossaries A glosary (or definition list) is a list of paragraphs each of which has a short title alongside it. Apart from glossaries, this format is useful for presenting a set of named elements to the reader. The format is as follows: <DL> <DT>Term<DD>definition pagagraph <DT>Term2<DD>Definition of term2 </DL>
Lists A list is a sequence of paragraphs, each of which is preceded by a special mark or sequence number. The format is: <UL> <LI> list element <LI> another list element... </UL> The opening list tag must be immediately followed by the first list element. The representation of the list is not defined here, but a bulleted list for unordered lists, and a sequence of numbered paragraphs for an ordered list would be quite appropriate. Other possibilities for interactive display include embedded scrollable browse panels. Opening list tags are: UL A list multi-line paragraphs, typically separated by some white space. MENU A list of smaller paragraphs. Typically one line per item, with a style more compact than UL. DIR A list of short elements, less than one line. Typical style is to arrange in four columns or provide a browser, etc. the closing tag must obviously match the opening tag. Web Browsers The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them. The browser does not display the HTML tags, but uses them to determine how to display the document:
HTML Page Structure All normal WebPages consist of a head and a body. Head Body The head is used for text and tags that do not show directly on the page. The body is used for text and tags that are shown directly on the page. Finally, all webpages have an <html> tag at the beginning and the end, telling the browser where the document starts and where it stops. The most basic code - the code you will use for any page you make, is shown below: Below is a visualization of an HTML page structure: <html> <head> <title>page title</title> </head> <body>
<h1>this is a heading</h1> <p>this is a paragraph.</p> <p>this is another paragraph.</p> </body> </html> HTML Versions Since the early days of the web, there have been many versions of HTML: Version Year HTML 1991 HTML 2.0 1995 HTML 3.2 1997 HTML 4.01 1999 XHTML 2000 HTML5 2014 HTML Editors Write HTML Using Notepad or TextEdit Web pages can be created and modified by using professional HTML editors.
However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac). We believe using a simple text editor is a good way to learn HTML. Follow the four steps below to create your first web page with Notepad or TextEdit. Step 1: Open Notepad (PC) Windows 8 or later: Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad. Windows 7 or earlier: Open Start > Programs > Accessories > Notepad Step 1: Open TextEdit (Mac) Open Finder > Applications > TextEdit Also change some preferences to get the application to save files correctly. In Preferences > Format > choose "Plain Text" Then under "Open and Save", check the box that says "Ignore rich text commands in HTML files". Then open a new document to place the code. Step 2: Write Some HTML Write or copy some HTML into Notepad.
<!DOCTYPE html> <html> <body> <h1>hi! This is Gaurav Gahtori.</h1> <p>my first paragraph.</p> </body> </html> Step 3: Save the HTML Page Save the file on your computer. Select File > Save as in the Notepad menu. Name the file "index.htm" and set the encoding to UTF-8 (which is the preferred encoding for HTML files). Step 4: View the HTML Page in Your Browser Open the saved HTML file in your favorite browser (double click on the file, or right-click - and choose "Open with").
HEAD SECTION The head section of the webpage includes all the stuff that does not show directly on the resulting page. The <title> and </title> tags encapsulate the title of your page. The title is what shows in the top of your browser window when the page is loaded. Right now it should say something like "Basics - Html Tutorial" on top of the window containing this text. Another thing you will often see in the head section is metatags. Metatags are used for, among other things, to improve the rankings in search engines. Quite often the head section contains javascript which is a programming language for more complex HTML pages. Finally, more and more pages contain codes for cascading style sheets (CSS). CSS is a rather new technique for optimizing the layout of major websites. Since these aspects are way out of reach at this stage we will proceed with explaining the body section. BODY SECTION The body of the document contains all that can be seen when the user loads the page. In the rest of this tutorial you can learn in detail about all the different aspects of HTML, including: Text
o Formatting o Resizing o Layout o Links Listing o To local pages o To pages at other sites o To bookmarks Images o Inserting images (GIF and jpg) o Adding a link to an image Backgrounds o Colors
o Images o Fixed Image Tables Frames Forms Metatags Hexadecimal Colors The last page in this introduction will give you an overview of how to proceed with the HTML tutorial (and beyond).