Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

ICT - HTML AND CSS

(BASIC ELEMENTS AND


ATTRIBUTES)
BRACIL G. CIMAFRANCA
PRAYER
HTML Elements
All HTML documents must start with a document type
declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends
with </html>.
The visible part of the HTML document is between
<body> and </body>.
The DOCTYPE Declaration
The <!DOCTYPE> declaration represents the document type, and helps
browsers to display web pages correctly.

It must only appear once, at the top of the page (before any HTML
tags).

The <!DOCTYPE> declaration is not case sensitive.

The <!DOCTYPE> declaration for HTML5 is:


HTML Links

HTML links are defined with the <a> tag:


<a href="https://www.facebook.com/">This is a link</a>
HTML Images

HTML images are defined with the <img> tag.

The source file (src), alternative text (alt), width, and height are
provided as attributes:

<img src="w3schools.jpg" alt="W3Schools.com" width="50%">


How to view an HTML Source

View HTML Source Code:


Right-click in an HTML page and select "View Page Source" (in Chrome) or "View Source"
(in Edge), or similar in other browsers. This will open a window containing the HTML
source code of the page.

Inspect an HTML Element:


Right-click on an element (or a blank area), and choose "Inspect" or "Inspect Element" to
see what elements are made up of (you will see both the HTML and the CSS). You can
also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.
Nested HTML Elements
<!DOCTYPE html>

<html>

<body>

<h1><My First Heading</h1>

<p>My first paragraph.</p>

</body>

</html>
HTML is NOT Case Sensitive

HTML tags are not case sensitive: <P> means the same as <p>.

The HTML standard does not require lowercase tags, but W3C
recommends lowercase in HTML, and demands lowercase for stricter
document types like XHTML.
HTML Attributes

● All HTML elements can have attributes


● Attributes are always specified in the start tag
● Attributes usually come in name/value pairs like:
name="value"
● <a href=”http://facebook.com/”> This is going to link
you to facebook </a>
The href attribute

The <a> tag defines a hyperlink. The href attribute specifies the URL of the
page the link goes to:

<a href="https://facebook.com/" target=”_blank”>Visit my facebook


account</a>

-- This is an example of an absolute path

-- The target attribute allows you to open the link in a new tab
Relative and Absolute Paths
Links pointing to other pages of the same website will have a relative path, which does not include the
domain (.com, .org, .edu, etc.) in the href attribute value. Because the link is pointing to another page on
the same website, the href attribute value needs to include only the filename of the page being linked to:
about.html, for example.

Should the page being linked to reside within a different directory, or folder, the href attribute value needs
to reflect this as well. Say the about.html page resides within the pages directory; the relative path would
then be pages/about.html.

Linking to other websites outside of the current one requires an absolute path, where the href attribute
value must include the full domain. A link to Google would need the href attribute value of
http://google.com, starting with http and including the domain, .com in this case.
Relative and Absolute Path Sample

<!-- Relative Path -->


<a href="about.html">About</a>

<!-- Absolute Path -->


<a href="http://www.facebook.com/">Open FB</a>
THAT’S ALL FOR THIS MEETING !!

You might also like