Professional Documents
Culture Documents
Class 5
Class 5
Course
Javed Iqbal
ji.rajpoot@gmail.com
HTML Class 5
Previous Class
• HTML Form Elements
• Input Elements, Text Field
• Label Elements
• Radio Button, Check Box
• Submit Button
• Attributes
• Select Elements, Visible Values, Allow Multiple Values
• Text Area, Field Set, Legends
• Input Types
• Input Restrictions
HTML Class 5
• HTML File Paths
• A file path describes the location of a file in a web site's folder structure.
Path Description
<img src="picture.jpg"> The "picture.jpg" file is located in the same folder as the current page
<img src="images/picture.jpg"> The "picture.jpg" file is located in the images folder in the current folder
<img src="/images/picture.jpg"> The "picture.jpg" file is located in the images folder at the root of the current web
<img src="../picture.jpg"> The "picture.jpg" file is located in the folder one level up from the current folder
HTML Class 5
<!DOCTYPE html>
<html>
<head>
<title>A Meaningful Page Title</title>
</head>
<body>
</body>
</html>
HTML Class 5
• The HTML <style> Element
• The <style> element is used to define style information for a single HTML page:
• <style>
body {background-color: powderblue;}
h1 {color: red;}
p {color: blue;}
</style>
• <link rel="stylesheet" href="mystyle.css">
HTML Class 5
• The HTML <meta> Elements
• The <meta> element is typically used to specify the character set, page description, keywords, author of the document, and viewport settings
• The metadata will not be displayed on the page but are used by browsers (how to display content or reload page), by search engines
(keywords), and other web services.
Examples
• Define the character set used:
• <meta charset="UTF-8">
• Define keywords for search engines:
• <meta name="keywords" content="HTML, CSS, JavaScript">
• Define a description of your web page:
• <meta name="description" content="Free Web tutorials">
• Define the author of a page:
• <meta name="author" content="John Doe">
• Refresh document every 30 seconds:
• <meta http-equiv="refresh" content="30">
• Setting the viewport to make your website look good on all devices:
• <meta name="viewport" content="width=device-width, initial-scale=1.0">
HTML Class 5
• <script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello JavaScript!";
}
</script>
HTML Class 5
• HTML Responsive Web Design
• Responsive web design is about creating web pages that look good on all devices!
• A responsive web design will automatically adjust for different screen sizes and viewports.
• Responsive Image
• Responsive images are images that scale nicely to fit any browser size.
• <img src="img_girl.jpg" style="width:100%;">
• Notice that in the example above, the image can be scaled up to be larger than its original size. A better solution, in
many cases, will be to use the max-width property instead.
• That way the text size will follow the size of the browser window:
• <h1 style="font-size:10vw">Hello World</h1>
HTML Class 5
• HTML Media
• Multimedia comes in many different formats. It can be almost anything you can hear or
see, like images, music, sound, videos, records, films, animations, and more.
• The HTML <video> Element
• To show a video in HTML, use the <video> element:
• <video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
HTML Class 5
• 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 <source> element allows you to specify alternative video files which the browser may choose from. The browser will use
• The text between the <video> and </video> tags will only be displayed in browsers that do not support the <video> element.
• YouTube Playlist
• A comma separated list of videos to play (in addition to the original URL).
<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?playlist=tgbNymZ7vqY&loop=1">
</iframe>
HTML Class 5
• YouTube Controls
• Add controls=0 to not display controls in the video player.
• Value 0: Player controls does not display.
• Value 1 (default): Player controls display.
<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?controls=0">
</iframe>