Found 2202 Articles for HTML

How to use splash vector graphics on your Responsive Site?

Rishi Raj
Updated on 25-Feb-2020 07:27:10

212 Views

Graphics for your responsive site can make it slower, but balancing it with vector graphics can help in minimizing the bandwidth. Through this, amazing graphics work great on mobile site too. Generally, canvas and SVG is used for this purpose.Use HTML5 Scalable Vector Graphics (SVG) to create a design for multiple screen sizes, since it handles it perfectly. Easily present vector based line drawings and do not worry about the pixels on your device since the graphics created with SVG are resolution independent. It scales the result and looks great in the browser.Here, we will look how to work with ... Read More

How to use HTML5 Geolocation Latitude/Longitude API?

Rishi Rathor
Updated on 18-May-2020 08:28:23

748 Views

HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.The geolocation APIs work with a new property of the global navigator object ie. Geolocation object.ExampleYou can try to run the following code to find the current location using the Geolocation API, with Latitude and Longitude coordinatesLive Demo                    function showLocation(position) {           ... Read More

How to use HTML5 localStorage and sessionStorage?

Nancy Den
Updated on 18-May-2020 08:00:52

524 Views

HTML5 introduced two mechanisms, similar to HTTP session cookies, for storing structured data on the client side and to overcome the following drawbacks.Cookies are included with every HTTP request, thereby slowing down your web application by transmitting the same data.Cookies are limited to about 4 KB of data. Not enough to store required data.The two mechanisms for storage are session storage and local storage and they would be used to handle different situations.Session StorageThe Session Storage is designed for scenarios where the user is carrying out a single transaction but could be carrying out multiple transactions in different windows at ... Read More

How to handle Geolocation errors in HTML5?

Krantik Chavan
Updated on 16-Jun-2020 07:37:10

1K+ Views

HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.Geolocation is complicated, and it is very much required to catch any error and handle it gracefully.The geolocations methods getCurrentPosition() and watchPosition() make use of an error handler callback method which gives PositionError object. This object has following two properties −PropertyTypeDescriptionCodeNumberContains a numeric code for the error.messageStringContains a numeric code for the error.The following table describes the possible ... Read More

How to use geolocation coordinates in HTML5?

Nishtha Thakur
Updated on 14-May-2020 10:46:51

386 Views

HTML5 Geolocation API lets you share your location with your favorite websites. A Javascript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map. The geolocation coordinates specifies the geographic location of the device.Geolocation methods getCurrentPosition() and getPositionUsingMethodName() specify the callback method that retrieves the location information. These methods are called asynchronously to an object Position which stores the complete location information.The Position object specifies the current geographic location of the device. The location is expressed as a set of ... Read More

Why to use canvas tag in HTML5?

Nishtha Thakur
Updated on 15-Jun-2020 11:53:50

266 Views

Specifies height of the canvas.The HTML tag is used to draw graphics, animations, etc. using scripting. The tag introduced in HTML5.Let’s see a simple element with two specific attributes width and height along with all the core HTML5 attributes like id, name, and class etc.Here are the attributes −AttributeValueDescriptionheight pixelsSpecifies height of the canvas.width pixelsSpecifies width of the canvas.ExampleYou can try to run the following code to learn how to use canvas to create a rectangle. The canvas element has a DOM method called getContext, which obtains rendering context and its drawing functions. This function takes one ... Read More

How to use placeholder attribute in HTML?

Anvi Jain
Updated on 14-May-2020 10:54:04

5K+ Views

If you want to set a hint for text area or input field, then use the HTML placeholder attribute. The hint is the expected value, which gets displayed before the user enters a value, for example, name, details, etc.ExampleYou can try to run the following code to learn how to use placeholder attribute in HTML.           Register                                              

How to play sound file in a web-page in the background?

Smita Kapse
Updated on 25-Feb-2020 07:37:38

25K+ Views

The HTML element is used to add audio to web page. To play sound file in the background on a web page, use the … element. Also, use the autoplay attribute. This will run music in the background whenever the page loads.Set the width and height in a way the player hides on the web page. The loop attribute is added to specify whether the audio will start over again.You can try to run the following code to play a sound file in a web page in the backgroundExampleLive Demo           HTML background music ... Read More

How to use min and max attributes in HTML?

Yaswanth Varma
Updated on 12-Oct-2022 13:37:18

5K+ Views

The min and max properties in HTML are used to specify the element's acceptable range of values. The max attribute sets the element's maximum value, whereas the min attribute sets the element's minimum value. For input restriction, the min and max attributes are used with the number and date input types. Syntax Following is the syntax to use min and max attributes Let’s dive into the following examples to get a clear idea of how to use min and max attributes in HTML. Using min &max Attribute The min and max attribute in HTML is ... Read More

How to use formtarget attribute in HTML?

Krantik Chavan
Updated on 15-Jun-2020 11:32:18

258 Views

The formtarget attribute in HTML is used to indicate where the response that is received after the form submission is displayed. It overrides the target attribute of the HTML form tag. Use the formtarget attribute only with input type submit an image.Here are the attribute values of the formtarget attribute −S. NoValueDescription1_blankResponse gets displayed in a new window or tab2_selfThe default value. The response gets displayed in the same frame.3_parentResponse gets displayed in the parent frame4_topResponse gets displayed in the full body of the window5framenameResponse gets displayed in a named iframeExampleYou can try to run the following code to learn ... Read More

Advertisements