Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Html

The <html> tag tells the browser that this is an HTML document.
The html element is the outermost element in HTML and XHTML documents. The html
element is also known as the root element.
The <h1> to <h6> tags are used to define HTML headings.
<h1> defines the largest heading and <h6> defines the smallest heading.
Attribute –align(left, center, right, justify )
Title

The <title> tag defines the title of the document.


The title element is required in all HTML/XHTML documents.
The title element: defines a title in the browser toolbar provides a title for the page when
it is added to favorites displays a title for the page in search-engine results
Body

The body element defines the document's body.


The body element contains all the contents of an HTML document, such as text,
hyperlinks, images, tables, lists, etc.
Attributes
alink-- the color of an active link <body alink="value">
background--  background image for a document. <body background="value">
bgcolor—background color of a document. <body bgcolor="value">
link-the default color of unvisited links in a document. <body link="value">
text-- the color of the text in a document <body text="value">
vlink—visited link color <body vlink="value">
A tag

The <a> tag defines an anchor. An anchor can be used in two ways:
To create a link to another document, by using the href attribute
To create a bookmark inside a document, by using the name attribute
The a element is usually referred to as a link or a hyperlink.
The most important attribute of the a element is the href attribute, which indicates the
link’s destination.
By default, links will appear as follows in all browsers:
 An unvisited link is underlined and blue
 A visited link is underlined and purple
 An active link is underlined and red
Attribute –target(_parent, _top, _blank, _self), href- url, name
examples:
<html><body><p>
This is a link to <a href="http://www.google.com/">Google</a>.
</p><p>This is a link to our <a href="default.asp" target=”_blank”>HTML reference</a>.</p>
</body></html>

1
Link to a location on the same window
<html><body>
<p><a href="#C4">See also Chapter 4</a></p>< h2>Chapter 1</h2>
<p>This chapter explains ba bla bla</p><h2>Chapter 3</h2>
<p>This chapter explains ba bla bla</p><h2><a name="C4">Chapter 4</a></h2>
<p>This chapter explains ba bla bla</p></body></html>

P tag

The <p> tag defines a paragraph.


The p element automatically creates some space before and after itself. The space is
automatically applied by the browser, or you can specify it in a style sheet.
Attribute-align
<i>, <b>, <big>, and <small> <sub><sup>
The <i>, <b>, <big>, and <small> <sub><sup>tags are all font-style tags. They are not
deprecated, but it is possible to achieve richer effect with CSS.
<BR>
The <br> tag inserts a single line break. The <br> tag is an empty tag which means that it
has no end tag.
<font>

The <font> tag specifies the font face, font size, and font color of text.
Color—rgb(x,x,x),#hex_num,name
Example:
<html><body><p><font size="3" color="red">This is some text!</font></p>
<p><font size="2" color="blue">This is some text!</font></p>
<p><font face="verdana" color="green">This is some text!</font></p>
</body></html>

<base>
The <base> tag specifies a default address or a default target for all links on a page.
The <base> tag goes inside the head element.
<img>

The <img> tag embeds an image in an HTML page.


Notice that images are not technically inserted into an HTML page, images are linked to
HTML pages. The <img> tag creates a holding space for the referenced image.
The <img> tag has two required attributes: src and alt.
Example
<img src="logo_w3s.gif" alt="W3Schools.com" border="5" width="200" height="100"
align="middle" hspace="20" />
<form>
The <form> tag is used to create an HTML form for user input.
A form can contain input elements like text fields, checkboxes, radio-buttons, submit
buttons and more. A form can also contain select menus, textarea, fieldset, legend, and
label elements.Forms are used to pass data to a server.

2
Attributes:
Action:The required action attribute specifies where to send the form-data when a form is
submitted. <form action="value">
Value--Where to send the form data.
Possible values:
 An absolute URL - points to another web site (like
action="http://www.example.com/example.htm")
 A relative URL - points to a file within a web site (like action="example.htm")
The method attribute specifies how to send form-data (the form-data is sent to the page specified
in the action attribute).
The form-data can be sent as URL variables (with method="get") or as HTTP post (with
method="post").
Notes on the "get" method:
o This method appends the form-data to the URL in name/value pairs
o This method is useful for form submissions where a user want to bookmark the result
o There is a limit to how much data you can place in a URL (varies between browsers),
therefore, you cannot be sure that all of the form-data will be correctly transferred
o Never use the "get" method to pass sensitive information! (password or other sensitive
information will be visible in the browser's address bar)
Notes on the "post" method:
o This method sends the form-data as an HTTP post transaction
o Form submissions with the "post" method cannot be bookmarked
o The "post" method is more robust and secure than "get", and "post" does not have size
limitations
target
_blank, _top, _parent, _self

<input>
The <input> tag is used to select user information.
An input field can vary in many ways, depending on the type attribute. An input field can
be a text field, a checkbox, a password field, a radio button, a button, and more.
Attributes:
type —<input type="value" />
text
<input type="text" /> defines a one-line input field that a user can enter text into.
Example
Email: <input type="text" name="email" value=”@gmail.com”/><br />
Pin: <input type="text" name="pin" />
Button
<input type="button" /> defines a clickable button, that does not do anything. The button
type is most often used to activate a JavaScript when a user clicks on the button.
<input type="button" value="Click me" onclick="msg()" />
Checkbox
<input type="checkbox" /> defines a checkbox. Checkboxes let a user select one or more
options of a limited number of choices.

3
<input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
<input type="checkbox" name="vehicle" value="Car" checked=”checked”/> I have a car
File
<input type="file" /> is used for file uploads.
<input type="file" />
Hidden
<input type="hidden" /> defines a hidden field. A hidden field is not visible for the user.
Hidden fields often store a default value, or have their value changed by a JavaScript.
<input type="hidden" name="country" value="Norway" />
Image
<input type="image" /> defines an image as a submit button.
The src and alt attribute are required with <input type="image">.
<input type="image" src="submit.gif" alt="Submit" />
Password
<input type="password" /> defines a password field. The characters in a password field
are masked (shown as asterisks or circles).
<input type="password" name="pwd" />
Radio
<input type="radio" /> defines a radio button. Radio buttons let a user select only one of
a limited number of choices.
<input type="radio" name="sex" value="male" /> Male<br />
<input type="radio" name="sex" value="female" /> Female
Reset Button
<input type="reset" /> defines a reset button. A reset button resets all form fields to their
initial values.
Tip: Use the reset button carefully! It can be annoying for users who accidentally activate
the reset button.
<input type="reset" />
Submit
<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.
<form action="form_action.asp" method="get">
Email: <input type="text" name="email" /><br />
<input type="submit" />
</form>
Accept
The accept attribute is only used with <input type="file"> and it specifies the types of
files that can be submitted through a file upload. <input accept="value" />
Checked
Specifies that an input element should be preselected when the page loads (for
type="checkbox" or type="radio")
The checked attribute specifies that an input element should be preselected when the page
loads.
The checked attribute is used with <input type="checkbox"> or <input type="radio">.
The checked attribute can also be set after the page load, with a JavaScript.

4
Disabled
The disabled attribute specifies that an input element should be disabled.
A disabled input element is unusable and un-clickable.
The disabled attribute can be set to keep a user from using an input field until some other
condition has been met (like selecting a checkbox, etc.). Then, a JavaScript is required to
remove the disabled value, and make the input element usable.
Readonly
The readonly attribute specifies that an input field should be read-only.
A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy
the text from it.
The readonly attribute can be set to keep a user from changing the value until some other
condition has been met (like selecting a checkbox, etc.). Then, a JavaScript is required to
remove the readonly value, and make the input field editable.
The readonly attribute can be used with <input type="text"> or <input type="password">

<table>

The <table> tag defines an HTML table.


A simple HTML table consists of the table element and one or more tr, th, and td
elements.
The tr element defines a table row, the th element defines a table header, and the td
element defines a table cell.
A more complex HTML table may also include caption, col, colgroup, thead, tfoot, and
tbody elements.
Attributes:
o The cellspacing attribute specifies the space between cells. <table
cellspacing="value">
o The cellpadding attribute specifies the space between the cell wall and the cell
content.<table cellpadding="value">
o The align attribute specifies the alignment of a table according to surrounding
text. <table align="value">(left,right,center)
o The border attribute specifies the width of the borders around a table.
The border attribute applies a border to each cell, and around the table. If the
value of the border attribute is changed, only the size of the border around the
table will change. The border inside the table will be 1 pixel.
o The bgcolor attribute specifies a background color of a table. <table
bgcolor="value">
o The width attribute specifies the width of a table.
If the width attribute is not set, a table takes up the space it needs to display the
table data.
<tbody>
The <tbody> tag is used to group the body content in an HTML table.
The tbody element should be used in conjunction with the thead and tfoot elements.
The thead element is used to group the header content in an HTML table and the tfoot
element is used to group the footer content in an HTML table.
The valign attribute is supported in all major browsers. (top,middle,bottom,baseline)

5
align
<TD>
The <td> tag defines a standard cell in an HTML table.
Ex:
<td valign="baseline" style="color:red; font-size:200%">$80</td>
An HTML table has two kinds of cells:
Header cells - contains header information (created with the th element)
Standard cells - contains data (created with the td element)
The text in a th element is bold and centered.
The text in a td element is regular and left-aligned.
Attributes:
Align, bgcolor
colspan- The colspan attribute defines the number of columns a cell should span.
Rowspan- The rowspan attribute defines the number of rows a cell should span.
height,width,valign
<tfoot>

The <tfoot> tag is used to group the footer content in an HTML table.
The tfoot element should be used in conjunction with the thead and tbody elements.
The thead element is used to group the header content in an HTML table and the tbody
element is used to group the body content in an HTML table.
<th>
The <th> tag defines a header cell in an HTML table.
An HTML table has two kinds of cells:
Header cells - contains header information (created with the th element)
Standard cells - contains data (created with the td element)
The text in a th element is bold and centered.
The text in a td element is regular and left-aligned.
<tr>

The <tr> tag defines a row in an HTML table.


A tr element contains one or more th or td elements.
Example:
<table border="1">
  <thead> <tr><th>Month</th><th>Savings</th> </tr></thead>
  <tfoot><tr> <td>Sum</td> <td>$180</td> </tr></tfoot>
  <tbody>
    <tr> <td>January</td> <td>$100</td> </tr>
    <tr> <td>February</td> <td>$80</td> </tr>
  </tbody>
</table>
Frameset:
The <frameset> tag defines a frameset.
The frameset element holds two or more frame elements. Each frame element holds a
separate document.

6
The frameset element states only how many columns or rows there will be in the
frameset.
The rows attribute specifies the size of, and the number of rows in a frameset.
Each frame’s height is specified in the rows attribute in a comma-separated list.
The cols attribute specifies the size of, and the number of columns in a frameset.
Each frame’s width is specified in the cols attribute in a comma-separated list.
<html>
<frameset rows=”30%,*”><frameset cols="25%,*,25%">
  <frame src="frame_a.htm" />  <frame src="frame_b.htm" />
  <frame src="frame_c.htm" /></frameset>
</html>

Frame:
The <frame> tag defines one particular window (frame) within a frameset.
Each frame in a frameset can have different attributes, such as border, scrolling, the
ability to resize, etc.
Attributes:
Scrolling-yes,no,auto
Frameborder- attribute specifies whether or not to display a border around a frame.
0-border off,1-border on
The noresize attribute specifies that a frame cannot be resized by the user.
The marginwidth attribute specifies the width between the content and the left and right
sides of the frame, in pixels.
The marginheight attribute specifies the height between the content and the top and
bottom of the frame, in pixels.
The name attribute specifies the name of a frame.
The name attribute of the frame element is used to reference the element in a JavaScript,
or to act as a target for a link.

You might also like