<tagname attrib1=“setting” attrib2=“setting” ...>
...
</tagname>
id
: A unique identifier to element
starting with "A-Z"class
: Assign a class to the element,
multiple classes are allowedtitle
: Specifies extra information about
an element
<em>I am important</em>
I am a <br /> break
<html>
<head>
<title>First Example</title>
</head>
<body>
<p> Hello World! </p>
</body>
</html>
Character | Coding | Number code |
---|---|---|
< | < | < |
> | > | > |
& | & | & |
' ' | [1] |   |
© | © | © |
λ | λ | λ |
<br />
<strong><em>test</strong></em>
<big>
)
renders the enclosed text at a font size one level larger than the
surrounding text.<center>
) is a block-level element that displays
its block-level or inline contents centered horizontally within its
containing element.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My test page</title>
</head>
<body>
<img src="images/firefox-icon.png" alt="My test image">
</body>
</html>
<!DOCTYPE html>
the doctype<html></html>
<head></head>
<meta></meta>
<title></title>
<body></body>
<html>
element represents
the root (top-level element) of an HTML document, so it is also referred
to as the root element.<body>
Element represents
the content of an HTML document.<h1>–<h6>
elements
represent six levels of section headings.
<h1>
is the highest section level
and <h6>
is the lowest.<section>
element
represents a standalone section — which
doesn't have a more specific semantic
element to represent it — contained within an HTML document.h1-h6
).<footer>
element
represents a footer for its nearest sectioning content or sectioning
root element. A footer typically contains information about the author
of the section, copyright data or links to related documents.<header>
element
represents introductory content, typically a group of introductory or
navigational aids. It may contain some heading elements but also a logo,
a search form, an author name, and other elements.<nav>
element represents a
section of a page whose purpose is to provide navigation links, either
within the current document or to other documents. Common examples of
navigation sections are menus, tables of contents, and indexes.<body>
and closing
</body>
tags.<p>
element represents a
paragraph.<pre>
element represents
preformatted text which is
to be presented exactly as written in the
HTML file.<ol>
element represents an
ordered list of items — typically rendered as a numbered list.<ul>
element represents an
unordered list of items, typically rendered as a bulleted list.<li>
element is used to
represent an item in a list.<dl>
element represents a
description list.<dt>
element) and descriptions
(provided by <dd>
elements).
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
<dl>
<dt>Hello</dt>
<dd>Means salam</dd>
</dl>
<div>
) is the generic container for flow content.<span>
element is a
generic inline container for phrasing content, which does not inherently
represent anything.<q>
element indicates that
the enclosed text is a short inline quotation. Most modern browsers
implement this by surrounding the text in quotation marks.<cite>
)
is used to describe a reference to a cited creative work, and must
include the title of that work.<a>
element (or anchor
element), with its href
attribute,
creates a hyperlink to web pages, files, email addresses (mailto),
locations in the same page (fragment), or anything else a URL can
address.<head>
, it is assumed as a file
in current domainmailto
for sending emailjavascript
to run code<a> </a>
is considered as
link name<a>
and before </a>
<a id="SctionResult">Results</a>
<h2 id="SctionResult">Results</h2>
To see result <a href="xyz#SctionResult">click here</a>
<br>
element produces a
line break in text (carriage-return).<code>
element displays
its contents styled in a fashion intended to indicate that the text is a
short fragment of computer code.<em>
element marks text
that has stress emphasis.<strong>
) indicates that its contents have strong importance, seriousness, or
urgency.<img>
element embeds an
image into the document.src
: address of file (local or remote)alt
: alternative message shown if image
cannot be displayed<iframe>
) represents a nested browsing context, embedding another HTML page into
the current one.<noscript>
element defines a
section of HTML to be inserted if a script type on the page is unsupported
or if scripting is currently turned off in the browser.<script>
element is used to
embed executable code or data; this is typically used to embed or refer to
JavaScript code.<table> </table>
<tr> </tr>
<td> </td>
<th> </th>
<table>
<caption>I am a lonely table</caption>
<thead>
<tr>
<th>Head Col 0</th>
<th>Head Col 1</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 0 Col 0</td>
<td>Row 0 Col 1</td>
</tr>
<tr>
<td>Row 1 Col 0</td>
<td>Row 1 Col 1</td>
</tr>
</tbody>
</table>
Head Col 0 | Head Col 1 |
---|---|
Row 0 Col 0 | Row 0 Col 1 |
Row 1 Col 0 | Row 1 Col 1 |
form
action
and
method
attributesaction
is a URLmethod
is a HTTP method used to send
dataget
: User input data is sent through
the query part of URL by HTTP GET methodpost
: User input data is sent as the
body of HTTP message by HTTP POST methodinput
elementstype
,
name
, and
value
attributestype
specifies the type of componentname
is the name of the componentvalue
(except buttons)name
=value
(user input or default) of the components in the form are sent to server
(using the
action
and
method
: POST, GET)type
="text"type
="password"<input>
, we use
<textarea> </textarea>
cols
&
rows
specifies # of columns & rows
<form action="http://httpbin.org/get" method="get">
Search:
<input type="text" name="txtSearch" value="" size="20" maxlength="64" />
<br />
Password:
<input type="password" name="pass" value="" size="20" maxlength="64" />
<br />
Text:
<textarea name="inputtext" cols="30" rows="3">
Please enter your message</textarea>
</form>
type
="checkbox"checked
="checked"<fieldset> </fieldset>
<legend> </legend>
<form action="http://httpbin.org/get" method="get">
<fieldset>
<legend><em>Web Development Skills</em></legend>
<input type="checkbox" name="skill_1" value="html" />
HTML<br />
<input type="checkbox" name="skill_2" value="xhtml" checked="checked" />
XHTML<br />
<input type="checkbox" name="skill_3" value="css" /> CSS<br />
<input type="checkbox" name="skill_4" value="JavaScript" />
JavaScript<br />
<input type="checkbox" name="skill_5" value="aspnet" />ASP.Net<br />
<input type="checkbox" name="skill_6" />
PHP <br />
<input type="submit" value="Submit" />
</fieldset>
</form>
type
="radio"
<form action="http://httpbin.org/get" method="get">
<fieldset>
<legend>University Grade</legend>
<input type="radio" name="grade" value="B" /> BS <br />
<input type="radio" name="grade" value="M" /> MS <br />
<input type="radio" name="grade" value="P" /> PhD <br />
<input type="radio" name="grade" value="PD" /> Post Doc <br />
<input type="submit" value="Submit" />
</fieldset>
</form>
<select name="selname"></select>
<option value="val"> text </option>
value
attribute is omitted, the value is taken from the text content of the
option
element.
<form action="http://httpbin.org/get" method="get">
Select color:
<select name="selColor">
<option value="r">Red</option>
<option value="g">Green</option>
<option value="b">Blue</option>
</select>
<input type="submit" value="Submit" />
</form>
<input>
type
="file"accept
= A MIME type to specify default
acceptable file format<form>
method
="post"enctype
="multipart/form-data"<input>
element(s) to upload file
data.
<form
action="http://httpbin.org/post"
method="post"
enctype="multipart/form-data"
>
<input type="file" name="fileUpload" accept="image/*" />
<input type="submit" value="Submit" />
</form>
type
The default behavior of the
button. Possible values are:"submit"
: To submit data to server."reset"
: To reset all inputs to
default values."button"
: To run client side script.name
of the button, submitted as a
pair with the button’s value as part of the form data.value
associated with the
button’s name when it’s submitted with the form data.
<form action="http://httpbin.org/get" method="get">
<input type="text" name="input" value="Default Value" /> <br />
<button type="submit">Submit Me</button><br />
<button type="reset">Reset</button> <br />
<button type="button">Click Me</button> <br />
</form>
Tab
key, hence
the name).<title>
)
defines the document's title that is shown in a browser's title bar or a
page's tab.<style>
element contains
style information for a document, or part of a document.<base>
element specifies the
base URL to use for all relative URLs in a document.<meta>
element represents
metadata that cannot be represented by other HTML meta-related elementsauthor
: the name of the document's
author.description
: a short and accurate
summary of the content of the page. Several browsers, like Firefox
and Opera, use this as the default description of bookmarked pages.generator
: the identifier of the
software that generated the page.keywords
: words relevant to the page's
content separated by commas.
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
<!-- The number of seconds until the page should redirect to another -->
<meta http-equiv="refresh" content="3;url=https://www.mozilla.org">
<meta charset="UTF-8">
<meta itemprop="description" content="my description">
<link>
) specifies relationships between the current document and an external
resource. This element is most commonly used to link to
stylesheets, but is also used to establish
site icons (both "favicon" style icons and
icons for the home screen and apps on mobile devices) among other things.