1.1 Introduction to HTML
1.1 Introduction to HTML
What is HTML?
Hypertext Markup Language (HTML) is a
standard markup language for
documents designed to be displayed in
internet browsers.
In making HTML, usually accompanied
by technologies such as CSS for styling
and Javascript for scripting.
TML 5 Document Declaration
Unpaired tags are single tags with no closing tag. These tags are also called
Singular Tags. These are also called non-container tags because they do not
contain any content.
The <img> tag should also contain the width and height
attributes, which specifies the width and height of the
image (in pixels):
Alt Attribute
The required alt attribute for the <img> tag specifies an alternate text for an image,
if the image for some reason cannot be displayed. This can be due to slow
connection, or an error in the src attribute, or if the user uses a screen reader.
We Suggest : Always
quote attribute value
Good
The HTML standard does not require
quotes around attribute values. However,
W3C recommends quotes in HTML, and
Bad demands quotes for stricter document
types like XHTML.
HTML Formatting
HTML Formatting
HTML contains several elements for
defining text with a special meaning.
HTML Comment
HTML Comment
<form>
.
form elements
.
</form>
The <input> Element
An <input> element can be displayed in many ways, depending on the type attribute.
The <select> Element
The <select> element is used to create a drop-down list.
The <select> element is most often used in a form, to collect user input.
The name attribute is needed to reference the form data after the form is submitted (if you omit the
name attribute, no data from the drop-down list will be submitted).
The id attribute is needed to associate the drop-down list with a label.
The <textarea> Element
The <textarea> tag defines a multi-line text input control.
The <textarea> element is often used in a form, to collect user inputs like comments or reviews.
A text area can hold an unlimited number of characters, and the text renders in a fixed-width font
(usually Courier).
The size of a text area is specified by the <cols> and <rows> attributes (or with CSS).
The <button> Element
The <button> tag defines a clickable button.
Inside a <button> element you can put text (and tags like <i>, <b>, <strong>, <br>, <img>, etc.). That
is not possible with a button created with the <input> element!
Tip: Always specify the type attribute for a <button> element, to tell browsers what type of button it
is.
HTML File Paths
Absolute vs Relative Path
Which is the best practice?
Absolute Path
An absolute file path is the full URL to a file:
Relative Path
A relative file path points to a file relative to the current
page. In the following example, the file path points to a
file in the images folder located at the root of the
current web:
Best Practice
It is best practice to use relative file paths (if possible).