Professional Documents
Culture Documents
HTML Note
HTML Note
What is HTML?
stands for Hyper Text Markup Language
</body>
</html>
Example Explained
The <!DOCTYPE html> declaration defines that this
document is an HTML5 document
The <html> element is the root element of an HTML page
The <head> element contains meta information about the
HTML page
The <title> element specifies a title for the HTML page (which
is shown in the browser's title bar or in the page's tab)
The <body> element defines the document's body, and is a
container for all the visible contents, such as headings,
paragraphs, images, hyperlinks, tables, lists, etc.
The <h1> element defines a large heading
The <p> element defines a paragraph
What is an HTML Element?
An HTML element is defined by a start tag, some
content, and an end tag:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
CONT…..
Step 3: Save the HTML Page
Save the file on your computer. Select File >
<h1>hello world</h1>
<p>This is a line one paragraph.</p>
<p1>This is a line two paragraph.</p1>
</body>
</html>
HTML Basic Examples
HTML Documents
All HTML documents must start with a
</body>
</html>
HTML Headings
<h2>HTML Links</h2>
<p>HTML links are defined with the a tag:</p>
<a href="https://www.w3schools.com">This is a
link</a>
</body>
</html>
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text
width="104" height="142">
Output
HTML Images
<h2>HTML Images</h2>
<p>HTML images are defined with the img tag:</p>
</body>
</html>
How to View HTML Source
HTML Elements
The HTML element is everything from the start tag to the
end tag:
elements.
The following example contains four HTML elements
</body>
</html>
HTML is Not Case Sensitive
document
<body>=Defines the document's body
about elements
Attributes are always specified in the start tag
like: name="value“
The href Attribute
The <a> tag defines a hyperlink. The href
W3Schools</a>
HTML Links
HTML links are hyperlinks.
following syntax:
<a href="url">link text</a>
document.
The target attribute can have one of the following values:
Cont.
_self - Default. Opens the document in the same
window/tab as it was clicked
_blank - Opens the document in a new window or
tab
_parent - Opens the document in the parent frame
_top - Opens the document in the full body of the
window
Example
Cont.…
Try it yourself
Visit W3Schools
If target="_blank", the link will open in a new browser window or
tab.
<!DOCTYPE html>
<html>
<body>
<h2>The target Attribute</h2>
<a href="https://www.w3schools.com/" target="_blank">Visit
W3Schools!</a>
<p>If target="_blank", the link will open in a new browser
window or tab.</p>
</body>
</html>
Absolute URLs vs. Relative URLs
Both examples above are using an absolute URL (a full web
address) in the href attribute.
A local link (a link to a page within the same website) is
specified with a relative URL (without the "https://www"
part):
Example
Try it yourself
Absolute URLs
W3C
Google
Relative URLs
HTML Images
CSS Tutorial
Cont.
<!DOCTYPE html>
<html>
<body>
<h2>Absolute URLs</h2>
<p><a href="https://www.w3.org/">W3C</a></p>
<p><a
href="https://www.google.com/">Google</a></p>
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p>
</body>
</html>
HTML Links - Use an Image as a Link
To use an image as a link, just put the <img> tag inside the <a> tag:
Example
Image as a Link
The image below is a link. Try to click on it.
HTML tutorial
<!DOCTYPE html>
<html>
<body>
<h2>Image as a Link</h2>
<p>The image below is a link. Try to click on it.</p>
<a href="default.asp"><img src="smiley.gif" alt="HTML tutorial"
style="width:42px;height:42px;"></a>
</body>
</html>
Link to an Email Address
Use mailto: inside the href attribute to create a link that opens
the user's email program (to let them send a new email):
Example
<!DOCTYPE html>
<html>
<body>
<h2>Link to an Email Address</h2>
<p>To create a link that opens in the user's email program (to let
them send a new email), use mailto: inside the href attribute:</p>
<p><ahref="mailto:someone@example.com">Send
email</a></p>
</body>
</html>
Summary