0% found this document useful (0 votes)
48 views

HTML File

HTML is the standard markup language used to create web pages. HTML uses tags like <h1> for headings, <p> for paragraphs, <a> for links, and <img> for images to structure and layout content. HTML documents also use tags like <form> and <input> to collect user input through forms. More advanced features include tables, lists, frames, and applying styles through CSS.

Uploaded by

Anjali Kamboj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

HTML File

HTML is the standard markup language used to create web pages. HTML uses tags like <h1> for headings, <p> for paragraphs, <a> for links, and <img> for images to structure and layout content. HTML documents also use tags like <form> and <input> to collect user input through forms. More advanced features include tables, lists, frames, and applying styles through CSS.

Uploaded by

Anjali Kamboj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 10

Introduction To HTML

HTML, which stands for Hyper Text Markup Language, is the predominant markup language for web pages. HTML is the basic building-blocks of webpages. HTML is written in the form of HTML elements consisting of tags, enclosed in angle brackets (like <html>) within the web page content. HTML tags normally come in pairs like <h1> and </h1>. The first tag in a pair is the start tag, the second tag is the end tag (they are also called opening tags and closing tags). In between these tags web designers can add text, tables, images, etc.

HTML Headings
HTML headings are defined with the <h1> to <h6> tags.

Example
<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.

Example
<p>This is a paragraph.</p> <p>This is another paragraph.</p>

HTML Links
HTML links are defined with the <a> tag.

Example
<a href="http://www.google.co.in">This is a link</a>

HTML Images
HTML images are defined with the <img> tag.

Example
<img src="w3schools.jpg" width="104" height="142" />

HTML Elements
An HTML element is everything from the start tag to the end tag: Start tag * <p> <a href="default.htm" > <br /> * The start tag is often called the opening tag. The end tag is often called the closing tag. Element content This is a paragraph This is a link </p> </a> End tag *

HTML Attributes
Attributes provide additional information about HTML elements. HTML elements can have attributes Attributes provide additional information about an element Attributes are always specified in the start tag Attributes come in name/value pairs like: name="value"

Attribute Example
HTML links are defined with the <a> tag. The link address is specified in the href attribute:

Example
<a href="http://www.w3schools.com">This is a link</a>

HTML Text Formatting


This text is bold

This text is big This text is italic


This is computer output

This is subscript and superscript

HTML Formatting Tags


HTML uses tags like <b> and <i> for formatting output, like bold or italic text. These HTML tags are called formatting tags .

HTML Fonts
The <font> tag is removed from HTML. The World Wide Web Consortium (W3C) has removed the <font> tag from its recommendations. In HTML style sheets (CSS) should be used to define the layout and display properties for many HTML elements. The example below shows how the HTML could look by using the <font> tag:

Example
<p> <font size="5" face="arial" color="red"> This paragraph is in Arial, size 5, and in red text color. </font> </p>

HTML Style Example - Background Color


The background-color property defines the background color for an element:

Example
<html>

<body style="background-color:yellow;"> <h2 style="background-color:red;">This is a heading</h2> <p style="background-color:green;">This is a paragraph.</p> </body> </html> The background-color property makes the "old" bgcolor attribute obsolete.

HTML Style Example - Font, Color and Size


The font-family, color, and font-size properties defines the font, color, and size of the text in an element:

Example
<html> <body> <h1 style="font-family:verdana;">A heading</h1> <p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p> </body> </html> The font-family, color, and font-size properties make the old <font> tag obsolete.

HTML Style Example - Text Alignment


The text-align property specifies the horizontal alignment of text in an element:

Example
<html> <body> <h1 style="text-align:center;">Center-aligned heading</h1> <p>This is a paragraph.</p> </body> </html>

The text-align property makes the old <center> tag obsolete.

HTML 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). td stands for "table data," and holds the content of a data cell. A <td> tag can contain text, links, images, lists, forms, other tables, etc.

Table Example
<table border="1"> <tr> <td>Sr. No.</td> <td>Names</td> </tr> <tr> <td>1.</td> <td>Anjali</td> </tr> </table> How the HTML code above looks in a browser:

Sr.no.

NAMES

1.

Anjali

HTML Lists
The most common HTML lists are ordered and unordered lists:

HTML Lists An ordered list:


The first list item The second list item The third list item

An unordered list:
List item List item List item

HTML Unordered Lists


An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items are marked with bullets (typically small black circles). <ul> <li>I am a girl</li> <li>My name is Anjali</li> </ul> How the HTML code above looks in a browser: I am a girl My name is Anjali

HTML Ordered Lists


An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. The list items are marked with numbers. <ol> <li>I am a girl</li> <li>My name is Anjali</li> </ol> How the HTML code above looks in a browser: 1.I am a girl 2.My name is Anjali

HTML Definition Lists


A definition list is a list of items, with a description of each item. The <dl> tag defines a definition list. The <dl> tag is used in conjunction with <dt> (defines the item in the list) and <dd> (describes the item in the list): <dl> <dt>Coffee</dt> <dd>- black hot drink</dd> <dt>Milk</dt> <dd>- white cold drink</dd> </dl> How the HTML code above looks in a browser: Coffee - black hot drink Milk - white cold drink

HTML Forms
HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, text area, field set, legend, and label elements. The <form> tag is used to create an HTML form: <form> . input elements . </form>

HTML Forms - The Input Element


The most important form element is the input element. The input element is used to select user information.

An input element can vary in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more. The most used input types are described below.

Text Fields
<input type="text" /> defines a one-line input field that a user can enter text into: <form> First name: <input type="text" name="first name" /><br /> Last name: <input type="text" name="last name" /> </form> How the HTML code above looks in a browser: First name: Last name: Note: The form itself is not visible. Also note that the default width of a text field is 20 characters.

Password Field
<input type="password" /> defines a password field: <form> Password: <input type="password" name="pwd" /> </form> How the HTML code above looks in a browser: Password: Note: The characters in a password field are masked (shown as asterisks or circles).

Radio Buttons
<input type="radio" /> defines a radio button. Radio buttons let a user select ONLY 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>

How the HTML code above looks in a browser: Male Female

Checkboxes
<input type="checkbox" /> defines a checkbox. Checkboxes let a user select ONE or MORE options of a limited number of choices. <form> <input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br /> <input type="checkbox" name="vehicle" value="Car" /> I have a car </form> How the HTML code above looks in a browser: I have a bike I have a car

Submit Button
<input type="submit" /> defines a submit button. A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input: <form name="input" action="html_form_action.asp" method="get"> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> </form> How the HTML code above looks in a browser: Username: 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_action.asp". The page will show you the received input

HTML Frames
With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.

The HTML frameset Element


The frameset element holds one or more frame elements. Each frame element can hold a separate document. The frameset element states HOW MANY columns or rows there will be in the frameset, and HOW MUCH percentage/pixels of space will occupy each of them.

The HTML frame Element


The <frame> tag defines one particular window (frame) within a frameset. In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The document "frame_a.htm" is put into the first column, and the document "frame_b.htm" is put into the second column: <frameset cols="25%,75%"> <frame src="frame_a.htm" /> <frame src="frame_b.htm" /> </frameset> Note: The frameset column size can also be set in pixels (cols="200,500"), and one of the columns can be set to use the remaining space, with an asterisk (cols="25%,*").

HTML Frame Tags


Tag <frameset> Defines a set of frames <frame /> Defines a sub window (a frame) <no frames> Defines a no frame section for browsers that do not handle frames Description

You might also like