for main headings,
for paragraphs, for paragraphs, Html4, W3School: !doctype HTML Head Title /title /head Body h1 /h1 P /P /body /HTML Html4, W3School: !doctype HTML Head Title /title /head Body h1 /h1 P /P /body /HTML What is HTML? </body> HTML Tags 1 Tip: The start tag is also called the opening tag, and the end tag Web Browsers The browser does not display the HTML tags, but uses them to determine It must only appear once, at the top of the page (before any HTML tags). <!DOCTYPE html> HTML EDITORS Web pages can be created and modified by using professional HTML editors. 2 Follow the steps below to create your first web page with Notepad or Windows 8 or later: Open the Start Screen (the window symbol at the bottom left on your Windows 7 or earlier: Save the file on your computer. Select File > Save as in the Notepad Name the file "index.htm" and set the encoding to UTF-8 (which is the Open the saved HTML file in your favorite browser (double click on the file, HTML Headings <h1> defines the most important heading. <h6> defines the least important HTML Paragraphs 3 HTML Links Example HTML Images The source file (src), alternative text (alt), width, and height are provided Example HTML Buttons Example HTML Lists Example <ol> 4 HTML Elements An HTML element usually consists of a start tag and an end tag, with Example <!DOCTYPE html> <html> <body> </body> </html> 5 Empty elements can be "closed" in the opening tag like this: <br />. HTML5 does not require empty elements to be closed. But if you want HTML tags are not case sensitive: <P> means the same as <p>. The HTML5 standard does not require lowercase tags, but W3C HTML Attributes HTML links are defined with the <a> tag. The link address is specified in 6 <img src="img_girl.jpg"> HTML images also have width and height attributes, which specifies the The value of the alt attribute can be read by screen readers. This way, The alt attribute is also useful if the image cannot be displayed (e.g. if it The style attribute is used to specify the styling of an element, like color, Example 7 <!DOCTYPE html> <html lang="en-US"> <body> ... </body> </html> The first two letters specify the language (en). If there is a dialect, add Here, a title attribute is added to the <p> element. The value of the title Example This is a paragraph. </p> 8 Bad: <a href=https://www.w3schools.com> Or vice versa: Chapter Summary 9 for images, and for links. Attributes provide additional information about elements, like the href attribute specifying a link's address or the src attribute providing an image's source file. HTML documents are made up of nested elements and follow a basic structure with a for metadata and
for visible content."> for main headings,
for images, and for links. Attributes provide additional information about elements, like the href attribute specifying a link's address or the src attribute providing an image's source file. HTML documents are made up of nested elements and follow a basic structure with a for metadata and for visible content.">
Uploaded by
Joser Icard OrojoUploaded by
Joser Icard OrojoHTML4, W3SCHOOL
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
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body> <h1>My First Heading</h1>
<p>My first paragraph.</p>
</html> 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 paragraphHTML 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
the closing tag.The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read
HTML documents and display them.
how to display the document.Only the content inside the <body> section is displayed in a browser.
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps
browsers to display web pages correctly.The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is:
Write HTML Using Notepad or TextEdit
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.
TextEdit.Step 1: Open Notepad (PC)
screen). Type Notepad.Open Start > Programs > Accessories > Notepad
Step 2: Write Some HTML
Write or copy some HTML into Notepad.
Step 3: Save the HTML Page
menu.
preferred encoding for HTML files).Step 4: View the HTML Page in Your Browser
or right-click - and choose "Open with"). HTML Basic Examples
HTML headings are defined with the <h1> to <h6> tags.
heading.
HTML paragraphs are defined with the <p> tag.HTML links are defined with the <a> tag:
<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.
HTML images are defined with the <img> tag.
as attributes:
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">HTML buttons are defined with the <button> tag:
<button>Click me</button>HTML lists are defined with the <ul> (unordered/bullet list) or
the <ol> (ordered/numbered list) tag, followed by <li> tags (list items):
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
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>
Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>
<br>
HTML elements with no content are called empty elements. Empty
elements do not have an end tag, such as the <br> element (which
indicates a line break). Nested HTML Elements
HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
This example contains four HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Empty HTML ElementsHTML elements with no content are called empty elements.<br> is an
empty element without a closing tag (the <br> tag defines a line
break):<p>This is a <br> paragraph with a line break.</p>
stricter validation, or if you need to make your document readable by
XML parsers, you must close all HTML elements properly.HTML Is Not Case Sensitive
recommends lowercase in HTML, and demands lowercase for stricter
document types like XHTML.Attributes provide additional information about HTML elements.
All HTML elements can have atributes.
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
the href attribute.<a href="https://www.w3schools.com">This is a link</a>
The src AttributeHTML images are defined with the <img> tag.
The filename of the image source is specified in the src attribute:
The width and height Attributes
width and height of the image:
<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.The alt Attribute
The alt attribute specifies an alternative text to be used, if an image
cannot be displayed.
someone "listening" to the webpage, e.g. a vision impaired person, can
"hear" the element.<img src="img_girl.jpg" alt="Girl with a jacket">
does not exist).The style Attribute
font, size etc.<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:
two more letters (US).The title Attribute
attribute will be displayed as a tooltip when you mouse over the
paragraph:<p title="I'm a tooltip">
We Suggest: Use Lowercase Attributes
The HTML5 standard does not require lowercase attribute names.The title attribute can be written with uppercase or lowercase
like title or TITLE.W3C recommends lowercase in HTML, and demands lowercase for
stricter document types like XHTML.
We Suggest: Quote (“) Attribute Values
The HTML5 standard does not require quotes around attribute values.The href attribute, demonstrated above, can be written without quotes:
Good:
<a href=”https://www.w3schools.com”>Single or Double Quotes?
Double quotes around attribute values are the most common in HTML,
but single quotes can also be used.In some situations, when the attribute value itself contains double
quotes, it is necessary to use single quotes:<p title='John "ShotGun" Nelson'>
<p title="John 'ShotGun' Nelson">
All HTML elements can have atributes
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
Always use lowercase attribute name
Always quote attribute values
10You might also like