Web Design-Lecture6-HTML5
Web Design-Lecture6-HTML5
Hoshang Qasim
E-mail: hoshang.awla@soran.edu.iq
2021
What is HTML5?
• HTML5 is the latest version of Hypertext Markup Language, the code that
describes web pages.
• In this version, new features are introduced to help Web application authors, new
elements are introduced.
• the standard programming language for describing the contents and appearance of
Web pages.
• World Wide Web Consortium (W3C) is in charge with delivering the HTML5
specification.
What is HTML5?
• Adds some new tags and attributes which allow for better semantics and for
dynamic elements that are activated using JavaScript.
4
span
Empty Elements
5
Block and Inline Elements
• There are two major types of HTML elements according to the way they
display on the browser:
Block-level elements or Inline elements
Block-level : elements, by default, use all the horizontal space they can get, appear on the screen
as if they have a carriage return or line break before and after them
• For example <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ul>, <ol>, <dl>, <pre>,
<hr >, <blockquote>,<address>
• All start on their own new lines,
and anything that follows them
6
Inline elements:
• can appear within sentences and do not need to appear on new lines
• Example <b>, <i>, <u>, <em>, <strong>, <sup>, <sub>, <small>, <ins>, <del>,
<code>, <cite>, <dfn>, <kbd>, and <var>
7
Block and Inline Elements
<h1>Block-Level Elements</h1>
<p><strong>Block-level elements</strong> always start on a new line. The
<code><h1></code> and <code><p></code> elements will not sit
on the same line, whereas the inline
elements flow with the rest of the text.
</p>
Note
8
inline elements may not contain block-level elements and can appear
only within block-level elements.
Id and Class
• The id and class attributes are used to easily identify a tag for manipulation (using
JavaScript) or styling (using CSS).
A HTML document cannot have two elements with the same id:
9
Semantic Elements
• Semantic tags tell the browser something about what's inside them.
• Clearly describes its meaning to both the browser and the developer.
• HTML 5 brings a whole new set of semantic tags to replace commonly used div
blocks.
10
Semantic & non-Semantic Elements
11
The markup for that document using HTML5 could look like the following
<body>
<header>...</header>
<nav>...</nav>
<article>
<section>
...
</section>
</article>
<aside>
...
</aside>
<footer>
...
12 </footer>
</body>
GROPING CONTENT – Non semantic
<div> Element
• It represents a generic block or container for flow content.
• designed to be used with classes and ids to give structure to documents.
• It has no effect on the content or layout until styled using CSS
• There’s no semantic meaning behind the <div>
<div class="header">
<h1>EXAMPLE CAFE</h1>
<p>Welcome to example cafe. We will be developing this site throughout
the book.</p>
13 </div>
GROPING CONTENT – Non semantic
<div class="myDiv">
<h2>This is a heading in a div element</h2>
<p>This is some text in a div element.</p>
</div>
</body>
</html>
GROPING CONTENT – Non semantic
➢ Semantic element
16
GROPING CONTENT - Semantic Elements
<header> Element
<header>
<h1>EXAMPLE CAFE</h1>
<p>Welcome to example cafe. We will be developing this site </p>
</header>
17
GROPING CONTENT - Semantic Elements
<article> Element
• Use an <article> element to mark up “independent content of the site
• such as a blog post, a forum post, a movie review, a news article.
• The basic rule is that if the content can be shared without the rest of the site context, than
it should be marked up as an article
<article>
<h1>Example Cafe, Great Food Delivered with Superior Markup and Style</h1>
<p>It's rare to find a restaurant that combines as many exemplary elements as the example
café.From the superior markup of the café's website to the delicious dishes served with
care nothing about the Example Café is left to chance.</p>
</article>
18
GROPING CONTENT - Semantic Elements
<article> Element
<html>
<head>
<style>
article {background-color:silver;}
</style>
</head>
<body>
<article>
<h1>Hyper Text Markup Language</h1>
<p>HTML It can be thought of as a programming language that is used
to place text, images and other contents on a webpage. . </p>
</article>
19
</body>
</html>
GROPING CONTENT - Semantic Elements
<article> Element
20
GROPING CONTENT - Semantic Elements
<section> Element
• Is used to represent a section of a document such as chapters, headers, footers, or any other
sections of the document.
• use it when none of the other semantic container <section>
<h1>Introduction</h1>
elements are appropriate. </section>
• A simplified example, just using the headings for <section>
<h1>Recipes</h1>
each section and no content, would look </section>
section>
something like this: <h1>Menu</h1>
</section>
<section>
21
<h1>Opening Times</h1>
</section>
GROPING CONTENT - Semantic Elements
22
GROPING CONTENT - Semantic Elements
<footer> Element
<footer>
<p>All content copyright Example Café </p>
</footer>
23
GROPING CONTENT - Semantic Elements
<nav> Element
<nav>
<p><a href="recipes.html">Recipes</p>
<p><a href="menu.html">Menu</a></p>
<p><a href="opening_times.html">Opening Times</a></p>
<p><a href-"contact.html">contact</a></p>
</nav>
24
GROPING CONTENT - Semantic Elements
<blockquote> Element
• Used to quote a passage from another source
• Text inside a <blockquote> element is usually indented from the left and right edges of the
surrounding text.
• The cite attribute can be used with blockquote element to indicate the source of the quote
• The value of this attribute should be a URL pointing to an online document.
The blockquote element represents a section that is quoted from another source.
Content inside a blockquote must be quoted from another source, whose address,
if it has one, may be cited in the cite attribute.
25 </blockquote>
GROPING CONTENT - Semantic Elements
<aside> Element
<article>
<h1>Example Cafe, Great Food Delivered with Superior Markup and Style</h1>
<p>It's rare to find a restaurant that combines as many exemplary elements as
the example café. From the superior markup of the café's website to the delicious
dishes served with care nothing about the Example Café is left to chance.</p>
<aside> It's rare to find a restaurant that combines as many exemplary
elements as the example café.</aside>
</article>
26
GROPING CONTENT - Semantic Elements
<aside> Element
27
GROPING CONTENT - Semantic Elements
<address> Element
• used to mark up contact information for an article element or for the document as a whole
<footer>
<address>Written by <a href=”ABC Group">
ABC Group</a><br>
Soran – Kurditan region </address>
28 <p>All content copyright Example Café </p>
</footer>
Canvas tag Drawing
29
Draw a Line into the Canvas
<html>
<body>
</body>
</html>
30
Semantic elements <figure> and <figcaption>
The purpose of a figure caption is to add a visual explanation to an image.
In HTML5, an image and a caption can be grouped together in a <figure> element:
31
GROPING CONTENT - Semantic Elements
32