CH3 HTML
CH3 HTML
HTML
Hypertext Markup Language (HTML)
• HTML stands for Hyper Text Markup Language
• HTML is the standard markup language for creating
Web pages
• 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
Hypertext Markup Language (HTML)
• The purpose of a web browser (Chrome, Edge, Firefox,
Safari) is to read HTML documents and display them
correctly.
• A browser does not display the HTML tags, but uses
them to determine how to display the document:
A Simple HTML Document
• <!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
HTML Elements
• 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 Editors
• <!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
•
HTML Documents
<!DOCTYPE html>
HTML Headings
<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>
• Example
• <img src=“google.jpg" alt=“goo.com.my" width="104" heig
ht="142">
HTML Elements
• Example
• <!DOCTYPE html>
<html>
<body>
</body>
</html>
Never Skip the End Tag
• Some HTML elements will display correctly, even if you forget the
end tag:
• Example
• <html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>
• Example
• <p>This is a <br> paragraph with a line break.</p>
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 Tag Reference
HTML Attributes
• The <a> tag defines a hyperlink. The href attribute specifies the
URL of the page the link goes to:
• Example
• <a href="https://www.google.com">Visit Google</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 specifies the width and height of the image (in pixels):
• Example
• <img src="img_girl.jpg" width="500" height="600">
• Example
• <img src="img_girl.jpg" width="500" height="600">
HTML Headings