html body { margin-top: 50px !important; } #top_form { position: fixed; top:0; left:0; width: 100%; margin:0; z-index: 2100000000; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; border-bottom:1px solid #151515; background:#FFC8C8; height:45px; line-height:45px; } #top_form input[name=url] { width: 550px; height: 20px; padding: 5px; font: 13px "Helvetica Neue",Helvetica,Arial,sans-serif; border: 0px none; background: none repeat scroll 0% 0% #FFF; }
for the visible page content. The declaration defines the document type as HTML5.">
0% found this document useful (0 votes)
2K views

!doctype HTML Head Title /title /head Body h1 /h1 P /P /body /HTML

HTML is the standard markup language used to create web pages. It uses tags to define elements like headings, paragraphs, links, images and more. Tags are enclosed in angle brackets and do not appear in the rendered page, but tell browsers how to display content. Common tags include <h1> for main headings, <p> for paragraphs, <a> for links, <img> for images, and <body> for the visible page content. The <!DOCTYPE> declaration defines the document type as HTML5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

!doctype HTML Head Title /title /head Body h1 /h1 P /P /body /HTML

HTML is the standard markup language used to create web pages. It uses tags to define elements like headings, paragraphs, links, images and more. Tags are enclosed in angle brackets and do not appear in the rendered page, but tell browsers how to display content. Common tags include <h1> for main headings, <p> for paragraphs, <a> for links, <img> for images, and <body> for the visible page content. The <!DOCTYPE> declaration defines the document type as HTML5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

What is HTML?

HTML is the standard markup language for creating Web pages.

 HTML stands for Hyper Text Markup Language


 HTML describes the structure of a Web page
 HTML consists of a series of elements
 HTML elements tell the browser how to display the content
 HTML elements are represented by tags
 HTML tags label pieces of content such as "heading", "paragraph",
"table", and so on
 Browsers do not display the HTML tags, but use them to render the
content of the page

Example HTML Document:

<!DOCTYPE html> - declaration defines this document to be HTML5


<html> - element is the root element of an HTML page
<head> - element contains meta information about the document
<title>Page Title</title> - element specifies a title for the document
</head>
<body> - element contains the visible page content

<h1>My First Heading</h1> - element defines a large heading


<p>My first paragraph.</p> - element defines a paragraph

</body>
</html>

Example Explained

 The <!DOCTYPE html> declaration defines this document to be HTML5


 The <html> element is the root element of an HTML page
 The <head> element contains meta information about the document
 The <title> element specifies a title for the document
 The <body> element contains the visible page content
 The <h1> element defines a large heading
 The <p> element defines a paragraph

HTML Tags

HTML tags are element names surrounded by angle brackets:

<tagname>content goes here...</tagname>

 HTML tags normally come in pairs like <p> and </p>


 The first tag in a pair is the start tag, the second tag is the end tag
 The end tag is written like the start tag, but with a forward
slash inserted before the tag name

Tip: The start tag is also called the opening tag, and the end tag
the closing tag.

Web Browsers

The purposehttps://www.w3schools.com/html/img_chrome.png of a web browser


(Chrome, Edge, Firefox, Safari) is to read HTML documents and display
them.

The browser does not display the HTML tags, but uses them to determine
how to display the document:

HTML Page Structure

Below is a visualization of an HTML page structure:


Note: Only the content inside the <body> section (the white area above) is
displayed in a browser.

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 Versions

Since the early days of the web, there have been many versions of HTML:
Write HTML Using Notepad or TextEdit

Web pages can be created and modified by using professional HTML editors.

However, for learning HTML we recommend a simple text editor like Notepad
(PC) or TextEdit (Mac).

We believe using a simple text editor is a good way to learn 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>

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>

The link's destination is specified in the href attribute.

Attributes are used to provide additional information about HTML elements.

You will learn more about attributes in a later chapter.

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 Buttons

HTML buttons are defined with the <button> tag:

Example
<button>Click me</button>

HTML Elements
An HTML element usually consists of a start tag and an end tag, with the
content inserted in between:

<tagname>Content goes here...</tagname>

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

<p>My first paragraph.</p>

HTML Attributes

 All HTML elements can have attributes


 Attributes provide additional information about an element
 Attributes are always specified in the start tag
 Attributes usually come in name/value pairs like: name="value"

The href Attribute

HTML links are defined with the <a> tag. The link address is specified in
the href attribute:

Example
<a href="https://www.w3schools.com">This is a link</a>

The src Attribute

HTML images are defined with the <img> tag.

The filename of the image source is specified in the src attribute:

Example
<img src="img_girl.jpg">

The width and height Attributes


HTML images also have width and height attributes, which specifies the width
and height of the image:

Example
<img src="img_girl.jpg" width="500" height="600">
The width and height are is specified in pixels by default; so width="500"
means 500 pixels wide.

You will learn more about images in our HTML Images chapter.

The alt Attribute


The alt attribute specifies an alternative text to be used, if an image cannot be
displayed.

The value of the alt attribute can be read by screen readers. This way,
someone "listening" to the webpage, e.g. a vision impaired person, can "hear"
the element.

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

The alt attribute is also useful if the image cannot be displayed (e.g. if it does
not exist):

Example
See what happens if we try to display an image that does not exist:

<img src="img_typo.jpg" alt="Girl with a jacket">

The style Attribute


The style attribute is used to specify the styling of an element, like color, font,
size etc.

Example
<p style="color:red">This is a paragraph.</p>

The lang Attribute


The language of the document can be declared in the <html> tag.

The language is declared with the lang attribute.


Declaring a language is important for accessibility applications (screen readers)
and search engines:

<!DOCTYPE html>
<html lang="en-US">
<body>

...

</body>
</html>

The first two letters specify the language (en). If there is a dialect, add two
more letters (US).

The lang Attribute


The language of the document can be declared in the <html> tag.

The language is declared with the lang attribute.

Declaring a language is important for accessibility applications (screen readers)


and search engines:

<!DOCTYPE html>
<html lang="en-US">
<body>

...

</body>
</html>
The first two letters specify the language (en). If there is a dialect, add two
more letters (US).

The title Attribute


Here, a title attribute is added to the <p> element. The value of the title
attribute will be displayed as a tooltip when you mouse over the paragraph:
Example
<p title="I'm a tooltip">
This is a paragraph.
</p>

Chapter Summary
 All HTML elements can have attributes
 The title attribute provides additional "tool-tip" information
 The href attribute provides address information for links
 The width and height attributes provide size information for images
 The alt attribute provides text for screen readers
 At W3Schools we always use lowercase attribute names
 At W3Schools we always quote attribute values

Headings Are Important


Search engines use the headings to index the structure and content of your web
pages.

Users often skim a page by its headings. It is important to use headings to show
the document structure.

<h1> headings should be used for main headings, followed by <h2> headings,
then the less important <h3>, and so on.
Note: Use HTML headings for headings only. Don't use headings to make
text BIG or bold.

Bigger Headings
Each HTML heading has a default size. However, you can specify the size for
any heading with the style attribute, using the CSS font-size property:

Example
<h1 style="font-size:60px;">Heading 1</h1>

HTML Horizontal Rules


The <hr> tag defines a thematic break in an HTML page, and is most often
displayed as a horizontal rule.

The HTML <head> Element


The HTML <head> element is a container for metadata. HTML metadata is data
about the HTML document. Metadata is not displayed.

The <head> element is placed between the <html> tag and the <body> tag:

Example
<!DOCTYPE html>
<html>

<head>
<title>My First HTML</title>
<meta charset="UTF-8">
</head>

<body>
.
.
.

Try it Yourself »

Note: Metadata typically define the document title, character set, styles,
scripts, and other meta information.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy