Arjun Thakur has Published 1109 Articles

Usage of :lang pseudo-class in CSS

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 12:46:57

87 Views

Use the :lang pseudo class to specify a language to use in a specified element. This class is useful in documents that must appeal to multiple languages that have different conventions for certain language constructs.ExampleYou can try to run the following code to understand the usage of :lang pseudo class ... Read More

CSS outline-color property

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 12:43:00

106 Views

The outline-color property allows you to specify the color of the outline. Its value should either be a color name, a hex color, or an RGB value, as with the color and border-color properties.ExampleYou can try to run the following code to implement outline-color property −         ... Read More

Specify the left padding of an element with CSS

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 11:03:59

106 Views

The padding-left specifies the left padding of an element. It sets the left padding of an element. This can take a value in terms of length of %.Eaxmple                                This is demo content.                           This is another demo content.            

Change HTML navbar color in Twitter Bootstrap 2.0.4

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 06:44:02

128 Views

To change navbar color,Set navbar background −navbarBackground: #c79810 ;Set navbar background highlight −navbarBackgroundHighlight: #eab92d ;Set navbar text color −navbarText: #f9ed9d ;Set navbar link color −navbarLinkColor: #f9ed9d ;

Get pixel color from canvas with HTML

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 06:30:51

224 Views

To get the pixel color from canvas, use the following code. This returns the color in rgba −var index = (Math.floor(y) * canvasWidth + Math.floor(x)) * 4 // color in rgba var r = data[index] var g = data[index + 1] var b = data[index + 2] var a = data[index + 3]

Drawing an image from a data URL to a HTML5 canvas

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 05:06:54

943 Views

If you have a data url, you can create an image to a canvas. This can be done as shown in the following code snippet −var myImg = new Image; myImg.src = strDataURI;The drawImage() method draws an image, canvas, or video onto the canvas. The drawImage() method can also draw ... Read More

Client Checking file size using HTML5

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 05:02:06

293 Views

Before HTML5, the file size was checked with flash but now flash is avoided in web apps. Still the file size on the client side can be checked by inserting the below given code inside an event listener.if (typeofFileReader !== "undefined") {    // file[0] is file 1    var ... Read More

Using HTML5 file uploads with AJAX and jQuery

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 04:58:53

459 Views

When the form is submitted, catch the submission process and try to run the following code snippet for file upload −// File 1 var myFile = document.getElementById('fileBox').files[0]; var reader = new FileReader(); reader.readAsText(file, 'UTF-8'); reader.onload = myFunc; function myFunc(event) {    var res = event.target.result; var fileName = document.getElementById('fileBox').files[0].name; ... Read More

Execute a script when the file is unavailable in HTML?

Arjun Thakur

Arjun Thakur

Updated on 03-Mar-2020 09:51:09

130 Views

Use the onemptied attribute in HTML to execute a script when the file is unavailable in HTML or it is empty.ExampleYou can try to run the following code to implement the onemptied attribute −                              Your browser does not support the video element.                      function display()          {             alert ("Sorry! Empty playlist!");          }          

Create a paragraph with a right-to-left direction in HTML5

Arjun Thakur

Arjun Thakur

Updated on 03-Mar-2020 05:38:02

282 Views

Use the dir attribute in HTML to set a paragraph with right-to-left direction. Add the value rtl to the dir attribute for the text to be placed from right-to-left.ExampleYou can try to run the following code to implement dir attribute −           This is demo paragraph. ... Read More

Advertisements