Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

HTML Material

HTML is the standard markup language for web documents. It uses tags to define headings, paragraphs, images, and hyperlinks. An HTML document contains a root <html> element with a <head> and <body>. The <body> contains visible content between opening and closing tags like <h1> for headings and <p> for paragraphs.

Uploaded by

ma3397043
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

HTML Material

HTML is the standard markup language for web documents. It uses tags to define headings, paragraphs, images, and hyperlinks. An HTML document contains a root <html> element with a <head> and <body>. The <body> contains visible content between opening and closing tags like <h1> for headings and <p> for paragraphs.

Uploaded by

ma3397043
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web

browser. It can be assisted by technologies such as Cascading Style Sheets and scripting languages such as JavaScript.

XHTML is a term that was historically used to describe HTML documents written to conform with XML syntax rules. The
following example shows an HTML document and corresponding “XHTML” document, and the accompanying HTTP Content-
Type headers they should be served with.

HTML5 is a markup language used for structuring and presenting content on the World Wide Web. It is the fifth and final major
HTML version that is a World Wide Web Consortium recommendation. The current specification is known as the HTML Living
Standard.

A Simple HTML Document

Example

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</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:

<tagname> Content goes here… </tagname>

The HTML element is everything from the start tag to the end tag:

<h1>My First Heading</h1>

<p>My first paragraph.</p>


HTML Page Structure

<html>

<head>

<title>Page title</title>

</head>

<body>

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

</body>

</html>

HTML Documents:

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>.

Example

<!DOCTYPE html>

<html>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>

</html>

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:

<!DOCTYPE html>

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important heading:

Example
<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<h3>This is heading 3</h3>

HTML Paragraphs

HTML paragraphs are defined with the <p> tag:

Example

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

HTML Links

HTML links are defined with the <a> tag:

Example

<a href=https://www.w3schools.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:

Example

<img src=”w3schools.jpg” alt=”W3Schools.com” width=”104” height=”142”>

HTML Elements

The HTML element is everything from the start tag to the end tag:

<tagname>Content goes here…</tagname>

Examples of some HTML elements:

<h1>My First Heading</h1>

<p>My first paragraph.</p>

Nested HTML Elements

HTML elements can be nested (this means that elements can contain other elements).

All HTML documents consist of nested HTML elements.

The following example contains four HTML elements (<html>, <body>, <h1> and <p>):

Example

<!DOCTYPE html>

<html>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>


</body>

</html>

Html attributes:

The href Attribute

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

Example

<a href=https://www.w3schools.com>Visit W3Schools</a>

The src Attribute

The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed:

Example

<img src=”img_girl.jpg”>The width and height Attributes

The <img> tag should also contain the width and height attributes, which specify the width and height of the image (in pixels):

Example

<img src=”img_girl.jpg” width=”500” height=”600”>

The 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 a slow connection, or an error in the src attribute, or if the user uses a screen reader.

Example

<img src=”img_girl.jpg” alt=”Girl with a jacket”>

The style Attribute

The style attribute is used to add styles to an element, such as color, font, size, and more.

Example

<p style=”color:red;”>This is a red paragraph.</p>

The title Attribute

The title attribute defines some extra information about an element.

The value of the title attribute will be displayed as a tooltip when you mouse over the element:

Example

<p title=”I’m a tooltip”>This is a paragraph.</p>

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important heading.

Example

<h1>Heading 1</h1>
<h2>Heading 2</h2>

<h3>Heading 3</h3>

<h4>Heading 4</h4>

<h5>Heading 5</h5>

<h6>Heading 6</h6>

You might also like