Creating An HTML Document
Creating An HTML Document
DOCUMENT
<CITE> FOR WORK TITLE
2
<BDO> FOR BI-DIRECTIONAL OVERRIDE
Example
The HTML <bdo> element <bdo dir="rtl">This text will be
defines bi-directional override. written from right to left</bdo>
The <bdo> element is used to
override the current text direction: Values
• LTR – Left to right
Dir – an enumerated attribute
indicating the directionality of the • RTL – right to left
element’s text. • Auto – Lets the user decide
3
COMMENT TAGS
4
BACKGROUND IMAGES
5
6
BACKGROUND IMAGES
If the background image is smaller than the element, the image will repeat itself,
horizontally and vertically, until it has reach the end of the element.
To avoid the background image from repeating itself, use the background-repeat
property
Example:
<style>
body {
background-image: url(blackcat.jpg ');
background-repeat: no-repeat;
}
</style>
7
8
BACKGROUND IMAGES
Example:
If you want the background image cover <style>
the entire element, you can set the
background-size property to cover. body {
Also, to make sure the entire element is background-image: url('img_girl.jpg');
always covered, set the background- background-repeat: no-repeat;
attachment property to fixed:
background-attachment: fixed;
As you can see, the image will cover the
entire element, with no stretching, the background-size: cover;
image will keep its original proportions. }
</style>
9
10
BACKGROUND IMAGES
If you want the background image stretch to fit the entire image in the element, you
can set the background-size property to 100% 100%:
Try resizing the browser window, and you will see that the image will stretch, but
always cover the entire element.
Example:
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style> 11
12
13
BACKGROUND IMAGES
Using the DIV element in creating background images
DIV – no special meaning. It represents its children. It can be used with the class, lang, and
title attributes to mark up semantics common to a group of consecutive elements.
Example:
<div style="background-image: url('img_girl.jpg');"></div>
<style>
div {
background-image: url(‘img_girl.jpg’);
}
</style>
14
15
16
VIDEOS IN HTML
17
VIDEOS IN HTML
The controls attribute adds video controls, like play, pause, and volume.
It is a good idea to always include width and height attributes. If height
and width are not set, the page might flicker while the video loads.
The <source> element allows you to specify alternative video files which
the browser may choose from. The browser will use the first recognized
format.
The text between the <video> and </video> tags will only be displayed
in browsers that do not support the <video> element.
18
VIDEOS IN HTML
<video> Autoplay
To start a video automatically use the autoplay attribute:
Example
<video width="320" height="240" autoplay>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
The autoplay attribute does not work in mobile devices like iPad and
iPhone.
19
VIDEOS IN HTML
<video> Loop
To start a video automatically use the loop attribute:
Example
<video width="320" height="240" autoplay loop >
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
The autoplay attribute does not work in mobile devices like iPad and
iPhone.
20
VIDEOS IN HTML
<video> Muted
To start a video automatically use the muted attribute:
Example
<video width="320" height="240" autoplay muted>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
The autoplay attribute does not work in mobile devices like iPad and
iPhone.
21
HTML VIDEO - MEDIA TYPES
MP4 video/mp4
WebM video/webm
Ogg video/ogg
22
BACKGROUND IMAGES
Before HTML5, audio files could only be played in a browser with a plug-in (like
flash).
The HTML5 <audio> element specifies a standard way to embed audio in a web
page.
To play an audio file in HTML, use the <audio> element:
Example:
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
23
BACKGROUND IMAGES
The controls attribute adds audio controls, like play, pause, and volume.
The <source> element allows you to specify alternative audio files which the browser may
choose from. The browser will use the first recognized format.
The text between the <audio> and </audio> tags will only be displayed in browsers that
do not support the <audio> element.
MP3 audio/mpeg
OGG audio/ogg
WAV audio/wav
24