Find Size of localStorage in HTML

Ankith Reddy
Updated on 24-Jun-2020 13:38:28

689 Views

localStorage is used to persist information across multiple sessions. It has a maximum size of 5MB.ExampleYou can try to run the following code snippet to check the size allocated −var sum = 0; // loop for size for(var i in localStorage) {    var amount = (localStorage[i].length * 2) / 1024 / 1024;    sum += amount;    document.write( i + " = " + amount.toFixed(2) + " MB"); } document.write( "Total = " + sum.toFixed(2) + " MB");

Create a Vertical Button Group with CSS

Chandu yadav
Updated on 24-Jun-2020 13:37:30

1K+ Views

You can try to run the following code to create a vertical button groupExampleLive Demo                    .mybtn .button {             background-color: orange;             border: 1px solid green;             width: 120px;             color: white;             font-size: 14px;             padding: 10px;             text-align: center;             text-decoration: none;             display: block;          }                              Result          Result          Result          Result          

Apply Antialiasing in HTML5 Canvas drawImage

Ankith Reddy
Updated on 24-Jun-2020 13:37:21

2K+ Views

For antialiasing, you need to set resampling quality.ctx.imageSmoothingQuality = "low|medium|high"Use an off-screen canvas to reduce the image to half −var c = document.createElement('canvas'), ocx = c.getContext('2d'); c.width = img.width * 0.5; c.height = img.height * 0.5; ocxx.drawImage(img, 0, 0, c.width, c.height);// drawing images reducing to half again and repeating itocx.drawImage(c, 0, 0, c.width * 0.5, cc.height * 0.5);

Play Local Hard Drive Video File with HTML5 Video Tag

George John
Updated on 24-Jun-2020 13:36:36

1K+ Views

The tag is used to add video, with the following video formats − MP4, WebM and OggOn selecting a file via the input element.The change event is firedThe event is fired for , , and elements when a change to the element's value is performed by the user.Getting File objectThe File interface provides information about files and allows JavaScript in a web page to access the content. Object of this type is returned by the files property of the HTML element, which eventually lets you access the list of files selected with the element.Object URL pointing ... Read More

Stream Large MP4 Files in HTML5

Chandu yadav
Updated on 24-Jun-2020 13:33:51

1K+ Views

Video files on the web sometimes need to be encoded in a special way in order for them to be played while downloading. In order for flash-based videos to work, data should be moved from the end to the start of the stream. A program called mp4 FastStart can do this for you.Programs like HandBrake have a "web" option that also does this when encoding. You need to ensure that your web server is not applying to gzip or deflate compression on top of the compression in the mp4 file.Compression allows your webserver to provide smaller file sizes, which load ... Read More

Is it autofocus, autofocus or autofocus in HTML5?

Chandu yadav
Updated on 24-Jun-2020 13:31:55

116 Views

As stated by w3.org −The autofocus attribute is a boolean attribute. The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.In HTML, use boolean attributes with or without values. For W3C, autofocus can be easily written autofocus or autofocus = "autofocus" or,autofocus = "".

Explode Function in PHP

Samual Sam
Updated on 24-Jun-2020 13:28:14

356 Views

The explode() function is used to split a string by string.Syntaxexplode(delimiter, str, limit)Parametersdelimiter − The boundary stringstr − String to splitlimit − Specifies the number of array elements to return.The following are possible values −Greater than 0 - Returns an array with a maximum of limit element(s)Less than 0 - Returns an array except for the last -limit elements()0 - Returns an array with one elementReturnThe explode() function returns an array of strings.The following is an example −Example Live DemoThe following is the output −OutputArray (    [0] => This    [1] => is    [2] => demo    [3] => ... Read More

Set the Color of the Rule Between Columns with CSS

Vrundesha Joshi
Updated on 24-Jun-2020 13:25:20

158 Views

To set the color between columns, use the column-rule-color property. You can try to run the following code to implement the column-rule-color property.With that, we will also set the style of the column rule:ExampleLive Demo                    .demo {             column-count: 4;             column-gap: 50px;             column-rule-color: orange;             column-rule-style: dashed;          }                              This ... Read More

Shorthand Property for Setting All the Column Rule Properties

Ankith Reddy
Updated on 24-Jun-2020 13:10:49

137 Views

The shorthand property for column rule is column-rule property. You can try to run the following code to implement the column-rule propertyExampleLive Demo                    .demo {             column-count: 4;             column-gap: 50px;             column-rule: 2px dotted orange;          }                              This is demo text. This is demo text. This is demo text.          This ... Read More

Cal to JD Function in PHP

Ankith Reddy
Updated on 24-Jun-2020 12:52:18

93 Views

The cal_to_jd() function converts a date to Julian day count. It returns a Julian day number.Syntaxcal_to_jd(calendar, month, day, year)Parameterscalendar − The calendar to convert from. Possible values −CAL_GREGORIANCAL_JULIANCAL_JEWISHCAL_FRENCHmonth  − Set the month as a number.day  − Set the day as a number.year  − Set the year as a number.ReturnThe cal_to_jd() function returns a Julian day number.ExampleThe following is an example − Live DemoOutput2458407

Advertisements