Introduction To HTML: Module - 1
Introduction To HTML: Module - 1
Module -1
3 Semantic Markup
4 Structure of
HTML
5 Quick Tour of
HTML 6 HTML
Semantic
Elements
The XML-based syntax rules for XHTML are pretty easy to follow.
The main rules are:
1. Lowercase tag names,
eg: <p>, <h1>
2. Attributes always within quotes,
eg: <p align=“left”>
HTML SYNTAX
Randy Connolly and Ricardo Hoar Fundamentals of Web Development
Elements and Attributes
More syntax
Trailing Slash
<body> parent
child
<p>
This is some <strong>text</strong>
</p>
<h1>Title goes here</h1>
sibling
<div>descendants
<p>
This is <span>important</span>
</p>
</div>
</body>
<body>
descendants children
<strong> <p>
ancestors
<span>
Incorrect Nesting
SEMANTIC MARKUP
Randy Connolly and Ricardo Hoar Fundamentals of Web Development
Semantic Markup
What does it mean?
STRUCTURE OF HTML
Randy Connolly and Ricardo Hoar Fundamentals of Web Development
Simplest HTML document
1 <!DOCTYPE html>
<title>A Very Small Document</title>
<p>This is a simple document with not much content</p>
Tells the browser (or any other client software that is reading this
HTML document) what type of document it is about to process.
Notice that it does not indicate what version of HTML is contained
within the document: it only specifies that it contains HTML.
1 <!DOCTYPE html>
<html>
2 <head lang="en">
<meta charset="utf-8"> 5
3 <title>Share Your Travels -- New York - Central Park</title>
<link rel="stylesheet" href="css/main.css"> 6
<script src="js/html5shiv.js"></script> 7
</head>
<body>
<h1>Main heading goes here</h1>
4 ...
</body>
</html>
HTML5 does not require the use of the <html>, <head>, and
<body>.
However, in XHTML they were required, and most web
authors continue to use them.
1 <!DOCTYPE html>
<html>
2 <head lang="en">
<meta charset="utf-8"> 5
3 <title>Share Your Travels -- New York - Central Park</title>
<link rel="stylesheet" href="css/main.css"> 6
<script src="js/html5shiv.js"></script> 7
</head>
<body>
<h1>Main heading goes here</h1>
4 ...
</body>
</html>
<h3>Reviews</h3>
6 <div> 7
<p>By Ricardo on <time>September 15, 2012</time></p>
<p>Easy on the HDR buddy.</p>
</div>
<div>
<p>By Susan on <time>October 1, 2012</time></p>
<p>I love Central Park.</p>
</div>
8
Label (image)
You can use the anchor element to create a wide range of links:
• Links to external sites (or to individual resources such as
images or movies on an external site).
• Links to other pages or resources within the current site.
• Links to other places within the current page.
• Links to particular locations on another page.
• Links that are instructions to the browser to start the
user’s email program.
• Links that are instructions to the browser to execute a
Javascript function.
<a href="index.html">Home</a>
Link to email
<a href="mailto://[email protected]">Someone</a>
If all the resources for the site reside within the same
directory (also referred to as a folder), then you can
reference those other resources simply via their
filename.
However, most real-world sites contain too many files
to put them all within a single directory.
For these situations, a relative pathname is required
along with the filename.
The pathname tells the browser where to locate the
file on the server.
Text in alt attribute provides a brief Specifies the width and height of
description of image’s content for users who image in pixels.
are unable to see it.
<header>
<img src="logo.gif" alt="logo" />
<h1>Fundamentals of Web Development</h1>
...
</header>
<article>
<header>
<h2>HTML5 Semantic Structure Elements </h2>
<p>By <em>Randy Connolly</em></p>
<p><time>September 30, 2012</time></p>
</header>
...
</article>
<header>
<hgroup>
<h1>Chapter Two: HTML 1</h1>
<h2>An Introduction</h2>
</hgroup>
</header>
<article>
<hgroup>
<h2>HTML5 Semantic Structure Elements </h2>
<h3>Overview</h3>
</hgroup>
</article>
3 Semantic Markup
4 Structure of
HTML
5 Quick Tour of
HTML 6 HTML
Semantic
Elements