George John has Published 1167 Articles

Alternatives to HTML5 iframe srcdoc?

George John

George John

Updated on 25-Jun-2020 07:44:29

435 Views

The HTML tag is used to create an inline frame.Example           HTML iframe Tag                   The srcdoc attribute specifies the HTML content of the page to show in the iframeAn alternative of the srcdoc attribute ... Read More

HTML5 Geolocation in Safari 5

George John

George John

Updated on 25-Jun-2020 07:40:03

818 Views

HTML5 Geolocation API lets you share your location with your favorite web sites. A JavaScript can capture your latitude and longitude, can be sent to backend web server, and do fancy location-aware things like finding local businesses or showing your location on a map.ExampleLet us see how to get the ... Read More

Measure text height on an HTML5 canvas element

George John

George John

Updated on 25-Jun-2020 07:12:51

1K+ Views

To get the text height, set the font in pt −context.font="15pt Calibri";Now, get the height like the following −var height = parseInt(context.font.match(/\d+/), 10);Above we have used a match to separate the font size from font face.

How to position text to center on an image with CSS

George John

George John

Updated on 25-Jun-2020 07:11:46

2K+ Views

To positioned text to center an image, use the transform property in CSS. You can try to run the following code for centered text over an imageExampleLive Demo                    .container {             position: relative;   ... Read More

CSS content: attr() on HTML5 progress doesn't work

George John

George John

Updated on 25-Jun-2020 06:48:39

155 Views

You need to add static content in CSS to make it work.Let us see an example −HTMLYou need to add the following CSS. This is to add CSS generated content before and after the HTML5 progress element −progress::-webkit-progress-bar:before, progress::-webkit-progress-bar:after {    content: '989'; }

Autocomplete text input for HTML5?

George John

George John

Updated on 25-Jun-2020 06:38:21

264 Views

Use the autocomplete attribute for autocomplete text input. The autocomplete attribute is used with a form elements to set the autocomplete feature on or off. If the autocomplete feature is on, the browser will automatically show values, based on what users entered before in the field.If the autocomplete feature is off, the ... Read More

Getting Tooltips for mobile browsers in HTML

George John

George John

Updated on 25-Jun-2020 06:22:05

892 Views

When you will click on an element with a title attribute, a child element with title text is appended. Let us see an example −For HTML −    The underlined character. jQuery −$("span[title]").click(function () {    var $title = $(this).find(".title");    if (!$title.length) {       $(this).append('' + $(this).attr("title") ... Read More

Use CSS width property for responsive image

George John

George John

Updated on 25-Jun-2020 06:09:28

73 Views

Set the width property to 100% for the responsive image. You can try to run the following code to make your image responsiveExampleLive Demo                                 img {                width: 100%;                height: auto;             }                         To check the effect, you need to resize the browser.          

Is there a Microsoft equivalent for HTML5 Server-Sent Events?

George John

George John

Updated on 25-Jun-2020 05:59:49

68 Views

To achieve your goal for HTML5 Server-Sent Events −Try polyfillIt would work for IE10 and IE11 as well. It starts with −if ("EventSource" in global) return;It only runs in web browsers that do not support EventSource.Refer the following GitTry websockets Works for IE10 and IE 11 and it also provides bi-directional ... Read More

How to actually work with HTML5 Canvas camera/viewport?

George John

George John

Updated on 25-Jun-2020 05:54:06

513 Views

For viewport usage, use the drawImage() method.ctx.clearRect(0, 0, game.width, game.height); // a full background image ctx.drawImage(background, cropLeft, cropTop, cropWidth, cropHeight, 0, 0, viewWidth, viewHeight);For the game −var myGame = document.getElementById("game"); var myCtx= myGame.getContext("2d"); myCtx.clearRect(0, 0, game.width, game.height); // using drawImage() method myCtx.drawImage(background, left, top, 350, 250, 0, 0, 250, ... Read More

Advertisements