HTML Notes PDF
HTML Notes PDF
HTML Notes PDF
What is HTML?
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
2
HTML Tags
HTML tags are keywords surrounded by angle brackets like <html> HTML tags normally come in pairs like <b> and </b> The first tag in a pair is the start tag, the second tag is the end tag Start and end tags are also called opening tags and closing tags.
3
Example
<html> <body> <h1>First Heading</h1> <p>first paragraph</p> </body> </html>
5
Example Explained
The text between <html> and </html> describes the web page The text between <body> and </body> is the visible page content The text between <h1> and </h1> is displayed as a heading The text between <p> and </p> is displayed as a paragraph
6
Editing HTML
We may use plain text editor (like Notepad) to edit HTML. This is the best way to learn HTML. However, professional web developers often prefer HTML editors like FrontPage or Dreamweaver, instead of writing plain text.
HTML Headings
HTML headings are defined with the <h1> to <h6> tags. <h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag. <p>This is a paragraph</p> <p>This is another paragraph</p>
10
HTML Links
HTML links are defined with the <a> tag.
<a href="http://www.du.ac.in">Delhi University</a>
11
HTML Images
HTML images are defined with the <img> tag.
<img src=dulogo.jpg" width="104" height="142" />
Note: The name and the size of the image are provided as attributes.
12
HTML Elements
An HTML element is everything from the start tag to the end tag:
Start tag Element content End tag
</p> </a> </br> <p> This is a paragraph <a href="default.htm" > This is a link <br>
*The start tag is often called the opening tag. The end tag is often called the closing tag.
13
14
15
16
Example Explained
The <p> element:
<p>This is my first paragraph</p>
The <p> element defines a paragraph in the HTML document The element has a start tag <p> and an end tag </p The element content is: This is my first paragraph
Contd..
17
The <body> element defines the body of the HTML document The element has a start tag <body> and an end tag </body> The element content is another HTML element (a paragraph)
18
19
20
21
HTML Attributes
HTML elements can have attributes Attributes provide additional information about the element Attributes are always specified in the start tag Attributes come in name/value pairs like: name="value"
22
Attribute Example
HTML links are defined with the <a> tag. The link address is provided as an attribute: <a href="http://www.du.ac.in">Delhi University</a>
23
24
25
HTML Comments
Comments can be inserted in the HTML code to make it more readable and understandable. Comments are ignored by the browser and are not displayed. Comments are written like this: <!-- This is a comment --> Note: There is an exclamation point after the opening bracket, but not before the closing bracket.
26
27
28
Formatting Text
<html> <body> <p><b>This text is bold</b></p> <p><strong>This text is strong</strong></p> <p><big>This text is big</big></p> <p><em>This text is emphasized</em></p> <p><i>This text is italic</i></p> <p><small>This text is small</small></p> <p>This is<sub> subscript</sub> and <sup>superscript</sup></p> </body> </html>
29
Address Formatting
<html> <body> <address> Donald Duck<br> BOX 555<br> Disneyland<br> USA </address> </body> </html>
30
32
33
An HTML Link
Link syntax: <a href="url">Link text</a> The start tag contains attributes about the link. The element content (Link text) defines the part to be displayed. Note: The element content doesn't have to be text. You can link from an image or any other HTML element.
34
The code above will display like this in a browser: Visit Delhi University
35
36
38
Tables
Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.
39
Example
<table border="1"> <tr> <td>row 1, <td>row 1, </tr> <tr> <td>row 2, <td>row 2, </tr> </table> cell 1</td> cell 2</td>
40
41
Headings in a Table
Headings in a table are defined with the <th> tag. <table border="1"> <tr> <th>Heading</th> <th>Another Heading</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>
42
Note that the borders around the empty table cell are missing (NB! Mozilla Firefox displays the border).
43
Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically small black circles). An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. <ol> <li>Coffee</li> <li>Milk</li> </ol>
46
Forms
A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. A form is defined with the <form> tag. <form> . input elements . </form>
47
Input
The most used form tag is the <input> tag. The type of input is specified with the type attribute. The most commonly used input types are being explained one by one.
48
Text Fields
Text fields are used when you want the user to type letters, numbers, etc. in a form. <form> First name: <input type="text" name="firstname" /> <br /> Last name: <input type="text" name="lastname" /> </form> Note that the form itself is not visible. Also note that in most browsers, the width of the text field is 20 characters by default.
49
Radio Buttons
Radio Buttons are used when you want the user to select one of a limited number of choices. <form> <input type="radio" name="sex" value="male" /> Male <br /> <input type="radio" name="sex" value="female" /> Female </form>
Checkboxes
Checkboxes are used when you want the user to select one or more options of a limited number of choices.
<form> I have a bike: <input type="checkbox" name="vehicle" value="Bike" /> <br /> I have a car: <input type="checkbox" name="vehicle" value="Car" /> <br /> I have an airplane: <input type="checkbox" name="vehicle" value="Airplane" /> </form>
51
52
If you type some characters in the text field above, and click the "Submit" button, the browser will send your input to a page called "html_form_submit.asp". The page will show you the received input.
53
54
Thank You
55