Full Stack Web Development Internship
Full Stack Web Development Internship
internship
DAY 6
Content
Attributes.
Meta tags live within the head tag of the HTML document.
There are many meta tags. Some of them help improve the SEO
(search engine optimisation) of your website, making sure that
the content of your site is relevant to what people are searching
for.
Why it is important for SEO?
Meta tags are important because they impact how your site
appears in the SERPs and how many people will be inclined to
click through to your website.
<meta> tags always go inside the <head> element, and are typically used to
specify character set, page description, keywords, author of the document,
and viewport settings.
There is a method to let web designers take control over the viewport (the
user's visible area of a web page), through the <meta> tag (See "Setting
The Viewport" example below).
META tag is the element in the HTML that interacts
with the search engines.
E.g.:
<meta charset="UTF-8">
Attributes.
Attribute Value Description
charset character_set Specifies the character encoding for the HTML document
content text Specifies the value associated with the http-equiv or name attribute
http-equiv content-security-policy Provides an HTTP header for the information/value of the content
content-type attribute
default-style
refresh
The meta description tag is used to explain in a brief and concise way what
your website is about.
You use the name and content attributes, with the text value passed
to content showing up in the search results:
How to add the name of the website's
author
This info shares who created and built the website, who
authored the content, or to whom the copyright belongs
2.Block and inline
Every HTML element has a default display value, depending on what type of element it is.
Block-level Elements
A block-level element always starts on a new line, and the browsers automatically add some space (a
A block-level element always takes up the full width available (stretches out to the left and right as far
as it can).
The <font> tag in HTML plays an important role in the web page
to create an attractive and readable web page. The font tag is
used to change the color, size, and style of a text. The base font
tag is used to set all the text to the same size, color and face.
Syntax:
autoplay autoplay Specifies that the audio will start playing as soon as it is ready
loop loop Specifies that the audio will start over again, every time it is
finished
preload auto Specifies if and how the author thinks the audio should be
metadata loaded when the page loads
none
<!DOCTYPE html>
<html>
<body>
<p>Audio Sample</p>
<!-- audio tag starts here -->
<audio controls (muted , autoplay)>
<source src="test.mp3" type="audio/mp3">
<source src="test.ogg" type="audio/ogg">
</audio>
<!-- audio tag ends here -->
</body>
</html>
HTML Video
The HTML <video> element is used to show a video on a
web page.
How it Works
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.
HTML Video - Media Types
MP4 video/mp4
WebM video/webm
Ogg video/ogg
Syntax:
<video src="" controls> </video>
Attributes
Autoplay: It tells the browser to immediately start
downloading the video and play it as soon as it can.
Preload: It intends to provide a hint to the browser about
what the author thinks will lead to the best user experience.
Loop: It tells the browser to automatically loop the video.
height: It sets the height of the video in CSS pixels.
width: It sets the width of the video in CSS pixels.
Controls: It shows the default video controls like play, pause,
volume, etc.
Muted: It mutes the audio from the video.
Poster: It loads an image to preview before the loading of
the video.
src: It is used to specify the URL of the video file
EXAMPLE
<!DOCTYPE html>
<html>
<body>
<center>
<h1 style="color:green;">HTML video</h1>
<h3>HTML video tag</h3>
<p>Adding video on the webpage
<p>
<video width="450" height="250" controls preload="auto">
<source src=“file name.mp4” type="video/mp4">
<source src=“filename.ogg” type="video/ogg"> </video>
</center>
</body>
</html>
HTML Canvas Tag
The HTML canvas element provides HTML a bitmapped
surface to work with. It is used to draw graphics on the
web page.
The HTML 5 <canvas> tag is used to draw graphics using
scripting language like JavaScript.
The <canvas> element is only a container for graphics, you
must need a scripting language to draw the graphics. The
<canvas> element allows for dynamic and scriptable
rendering of 2D shapes and bitmap images.
It is a low level, procedural model that updates a bitmap
and does not have a built-in scene. There are several
methods in canvas to draw paths, boxes, circles, text and
add images.
How to create a HTML canvas?
A canvas is a rectangle like area on an HTML page. It is
specified with canvas element. By default, the <canvas>
element has no border and no content, it is like a container.
Note: The <canvas> tag is new in HTML5.
Syntax:
<canvas id = "script"> Contents... </canvas>
Attributes: The tag accepts two attributes as mentioned
above and described below.
height: This attribute is used to set the height of the canvas.
width: This attribute is used to set the width of the canvas.
<canvas id = "mycanvas" width ="200" height ="100"> </
canvas>
HTML Canvas Tag Example
<!DOCTYPE html>
<html>
<body>
<!-- canvas Tag starts here -->
<canvas id = “HTML canvas" width = "200"
height = "100" style = "border:1px solid black">
</canvas>
<!-- canvas Tag ends here -->
</body>
</html>
Output:
Note: It is always necessary to specify the id attribute and the height & width attribute to define the
size of the canvas. You can have multiple canvas elements on one HTML page.