HTML Deck 3 Flashcards
(40 cards)
What are Semantic Elements?
Semantic elements are those which describe the particular meaning to the browser and the developer. Elements like <form>, <table>, <article>, <figure>, etc., are semantic elements.</figure>
What is the difference between <meter> tag and <progress> tag?</progress></meter>
<progress> tag should be used when we want to show the completion progress of a task, whereas if we just want a scalar measurement within a known range or fraction value. Also, we can specify multiple extra attributes for <meter> tags like ‘form’, ‘low’, ‘high’, ‘min’, etc.
</meter></progress>
Is drag and drop possible using HTML5 and how?
Yes, in HTML5 we can drag and drop an element. This can be achieved using the drag and drop-related events to be used with the element which we want to drag and drop.
Difference between SVG and Canvas HTML5 element?
SVG VS Canvas
SVG is a vector based i.e., composed of shapes. It is Raster based i.e., composed of pixels.
SVG works better with a larger surface. Canvas works better with a smaller surface.
SVG can be modified using CSS and scripts. Canvas can only be modified using scripts.
SVG is highly scalable. So we can print at high quality with high resolution. It is less scalable.
What type of audio files can be played using HTML5?
HTML5 supports the following three types of audio file formats:
Mp3
WAV
Ogg
What are the significant goals of the HTML5 specification?
These were the target area of the HTML5 specs:
Introduction of new element tags to better structure the web page such as <header> tag.
Forming a standard in cross-browser behavior and support for different devices and platforms
Backward compatible with the older version HTML web pages
Introduction of basic interactive elements without the dependency of plugins such as <video> tag instead of the flash plugin.</video>
Explain the concept of web storage in HTML5.
This web storage helps in storing some of the static data in the local storage of the browser so that we do not need to fetch it from the server every time we need it. There is a size limit based on different browsers. This helps in decreasing the load time and a smooth user experience. There are two types of web storage that are used to store data locally in HTML5:
Local Storage - This helps in storing data that will be retained even though the user reopens the browser. It is stored for each webapp on different browsers.
Session Storage - This is used for one session only. After the user closes the browser this gets deleted.
What is Microdata in HTML5?
It is used to help extract data for site crawlers and search engines. It is basically a group of name-value pairs. The groups are called items, and each name-value pair is a property. Most of the search engines like Google, Microsoft, Yandex, etc follow schema.org vocabulary to extract this microdata.
<div>
<span>Interviewbit Games</span> -
REQUIRES <span>ANDROID</span><br></br>
<link></link>
<div>
RATING:
<span>4.6</span> (
<span>8864</span> ratings )
</div>
<div>
Price: Rs.<span>1.00</span>
<meta></meta>
</div>
</div>
itemid – The unique, global identifier of an item.
itemprop – Used to add properties to an item.
itemref – Provides a list of element ids with additional properties.
itemscope – It defines the scope of the itemtype associated with it.
itemtype – Specifies the URL of the vocabulary that will be used to define itemprop.
Which tag is used for representing the result of a calculation? Explain its attributes.
The <output> tag is used for representing the result of a calculation. It has the following attributes:</output>
for - It defines the relationship between the elements used in calculation and result.
form - This is used to define the form the output element belongs to.
name - The name of the output element.
<form>
<input></input> +
<input></input><br></br>
The output is: <output></output>
</form>
What is new about the relationship between the <header> and <h1> tags in HTML5?
As HTML5 was all about better semantics and arrangements of the tags and elements, the <header> tag specifies the header section of the webpage. Unlike in previous version there was one <h1> element for the entire webpage, now this is the header for one section such as <article> or <section>. According to the HTML5 specification, each <header> element must at least have one <h1> tag.
Explain HTML5 Graphics.
HTML5 supports two kinds of graphics:
Canvas - It is like drawing on a whitepaper or a blank webpage. We can add different graphic designs on web pages with available methods for drawing various geometrical shapes.
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<canvas></canvas>
</body>
</html>
SVG - Scalable Vector Graphics are used mostly for diagrams or icons. It follows the XML format.
<!DOCTYPE html>
<html>
<body>
<svg>
<rect></rect>
</svg>
</body>
</html>
Both of the above examples produce this output and represent two different approaches provided by HTML5 to implement graphical aspects in the webpage.
Explain new input types provided by HTML5 for forms?
Following are the significant new data types offered by HTML5:
Date - Only select date by using type = “date”
Week - Pick a week by using type = “week”
Month - Only select month by using type = “month”
Time - Only select time by using type = “time”.
Datetime - Combination of date and time by using type = “datetime”
Datetime-local - Combination of date and time by using type = “datetime-local.” but ignoring the timezone
Color - Accepts multiple colors using type = “color”
Email - Accepts one or more email addresses using type = “email”
Number - Accepts a numerical value with additional checks like min and max using type = “number”
Search - Allows searching queries by inputting text using type = “search”
Tel - Allows different phone numbers by using type = “tel”
Placeholder - To display a short hint in the input fields before entering a value using type = “placeholder”
Range - Accepts a numerical value within a specific range using type = “range”
Url - Accepts a web address using type = “url”
what is the difference between an element and a tag in html
HTML Tags are building blocks of HTML Page. HTML Elements are components that are used in HTML Page.
What are the New tags in Media Elements in HTML5?
<audio> - Used for sounds, audio streams, or music, embed audio content without any additional plug-in.
<video> - Used for video streams, embed video content etc.
<source></source> - Used for multiple media resources in media elements, such as audio, video, etc.
<embed></embed> - Used for an external application or embedded content.
<track></track> - Used for subtitles in the media elements such as video or audio.
<label>
Video:
</label>
<video>
<source></source>
<track></track>
</video>
<br></br>
<label>
Embed:
</label>
<embed></embed>
<br></br>
<label>
Audio:
</label>
<audio>
<source></source>
</audio>
</video></audio>
Why do you think the addition of drag-and-drop functionality in HTML5 is important? How will you make an image draggable in HTML5?
The drag and drop functionality is a very intuitive way to select local files. This is similar to what most of the OS have copy functionality thus making it very easy for the user to comprehend. Before the native drag and drop API, this was achievable by writing complex Javascript programming or external frameworks like jQuery.
To enable this functionality there is a draggable attribute in the <img></img> tag and need to set ondrop and ondragover attribute to an eventhandler available in scripts.
<!DOCTYPE HTML>
<html>
<head>
<script> function allowDrop(ev) { ev.preventDefault(); } function drop(ev) { ... } </script>
</head>
<body>
...
<div></div>
<br></br>
<img></img>
...
</body>
</html>
Why do we need the MathML element in HTML5?
MathML stands for Mathematical Markup Language. It is used for displaying mathematical expressions on web pages. For this <math> tag is used.</math>
What are the server-sent events in HTML5?
The events pushed from the webserver to the browsers are called server-sent events. DOM elements can be continuously updated using these events. This has a major advantage over straight-up polling. In polling, there is a lot of overhead since every time it is establishing an HTTP connection and tearing it down whereas, in server-sent events, there is one long-lived HTTP connection. To use a server-sent event, <eventsource> element is used. The src attribute of this element specifies the URL from which sends a data stream having the events.</eventsource>
<eventsource></eventsource>
What are Web Workers?
These are added to bring parallelism and async capability. It runs in the background to do the computationally expensive tasks without yielding to make the page responsive. It is achieved by starting a separate thread for such tasks. These are not meant to perform UI operations. There are three types of web workers:
Dedicated Workers - These are workers that are utilized by a single script.
Shared Workers -These are workers that are utilized by multiple scripts running in different windows, IFrames, etc.
Service Workers - These act as proxy servers between web applications, the browser, and the network. Mostly used for push notifications and sync APIs.
<p>Count numbers: <output></output></p>
<button>Start Worker</button>
<button>Stop Worker</button>
var w;
function startWorker() {
if(typeof(Worker) !== "undefined") {
if(typeof(w) == "undefined") {
w = new Worker("demo_workers.js");
}
w.onmessage = function(event) {
document.getElementById("result").innerHTML = event.data;
};
}
}
function stopWorker() {
w.terminate();
w = undefined;
}
What is the usage of a novalidate attribute for the form tag that is introduced in HTML5?
Its value is a boolean type that indicates whether or not the data being submitted by the form will be validated beforehand. By making this false, forms can be submitted without validation which helps users to resume later also.
<form>
Name:<br></br><input></input><br></br>
Doubt:<br></br><input></input><br></br>
<input></input>
</form>
What are raster images and vector images?
Raster Images - The raster image is defined by the arrangement of pixels in a grid with exactly what color the pixel should be. Few raster file formats include PNG(.png), JPEG(.jpg), etc.
Vector Images - The vector image is defined using algorithms with shape and path definitions that can be used to render the image on-screen written in a similar markup fashion. The file extension is .svg
How to support SVG in old browsers?
To support old browsers instead of defining the resource of svg in src attribute of <img></img> tag, it should be defined in srcset attribute and in src the fallback png file should be defined.
<img></img>
What are different approaches to make an image responsive?
Art direction - Using <picture> element the landscape image fully shown in desktop layout can be zoomed in with the main subject in focus for a portrait layout.</picture>
<picture>
<source></source>
<img></img>
</picture>
Resolution switching - Instead of zoom and crop the images can be scaled accordingly using vector graphics. Also, this can be further optimized to serve different pixel density screens as well.
For example SVG
<svg>
<circle></circle>
</svg>
What is a manifest file in HTML5?
The manifest file is used to list down resources that can be cached. Browsers use this information to make the web page load faster than the first time. There are 3 sections in the manifest file
CACHE Manifest - Files needs to be cached
Network - File never to be cached, always need a network connection.
Fallback - Fallback files in case a page is inaccessible
CACHE MANIFEST
# 2012-06-16 v1.0.0
/style.css
/logo.gif
/main.js
NETWORK:
login.php
FALLBACK:
/html/ /offline.html
<!DOCTYPE HTML>
<html>
...
...
</html>
What is the Geolocation API in HTML5?
Geolocation API is used to share the physical location of the client with websites. This helps in serving locale-based content and a unique experience to the user, based on their location. This works with a new property of the global navigator object and most of the modern browsers support this.
var geolocation = navigator.geolocation;
Click "try it" button to get your coordinates.
The above example asks for user permission for accessing the location data via geolocation API and after clicking the button the coordinates of the physical location of the client get displayed.composed
and composedPath
demo
: It is used to define a header cell in a table. | : It is used to define a cell in a table.
|
---|