Daniol Thomas has Published 212 Articles

Python Program Exit handlers (atexit)

Daniol Thomas

Daniol Thomas

Updated on 27-Jun-2020 14:38:59

496 Views

The atexit module in the standard distribution of Python has two functions – register() and unregister(). Both functions take some existing function as an argument. Registered functions are executed automatically when the interpreter session is terminated normally.If more than one functions are registered, their execution is in the reverse order ... Read More

Python Utilities for with-statement contexts (contextlib)

Daniol Thomas

Daniol Thomas

Updated on 27-Jun-2020 14:29:17

292 Views

contextlib module of Python's standard library defines ContextManager class whose object properly manages the resources within a program. Python has with keyword that works with context managers. The file object (which is returned by the built-in open() function) supports ContextManager API. Hence we often find with keyword used while working ... Read More

Perform Animation on CSS padding-top property

Daniol Thomas

Daniol Thomas

Updated on 25-Jun-2020 14:59:08

173 Views

To implement animation on padding-top property with CSS, you can try to run the following code −ExampleLive Demo                    div {             width: 350px;             height: 150px;             outline: 3px solid maroon;             animation: myanim 3s infinite;          }          @keyframes myanim {             30% {                padding-top: 60px;             }          }                     CSS padding-top property          

CSS voice-range Speech Media property

Daniol Thomas

Daniol Thomas

Updated on 25-Jun-2020 14:48:43

69 Views

The voice-range property in CSS is used to set the range of the speaking voice. This is the pitch range.The following is the syntax:voice-range: [[x-low | low | medium | high | x-high]]Above, set the range of pitch i.e. low, medium, high, etc.The following is an example of the voice-range ... Read More

HTML5 data-* attribute type casting strings and numbers

Daniol Thomas

Daniol Thomas

Updated on 25-Jun-2020 05:31:11

87 Views

For data-attribute typecasting of Numbers and String, use −[...document.querySelectorAll("a")].forEach(a =>    console.log("type: %s, value: %o", typeof a.dataset.value, a.dataset.value) );The above is for the following data-attributes −6.0 6.5

HTML5 Canvas to PNG File

Daniol Thomas

Daniol Thomas

Updated on 24-Jun-2020 14:20:32

499 Views

To convert HTML5 canvas to PNG, follow the below-given steps −You need to add the generated data URL to the href attribute of an tag.Dialog for base64 image −Add a filename −Now define http headers −headers=Content-Disposition: attachment; filename=newimg.pngTo deal with the RAM of the web browser and make its utilization ... Read More

Shorthand property to set columns with CSS

Daniol Thomas

Daniol Thomas

Updated on 24-Jun-2020 14:05:09

89 Views

Use the columns property to set columns with CSS. You can try to run the following code to implement the columns property:ExampleLive Demo                    .demo {             column-rule-color: gray;             columns: 100px ... Read More

Center pagination on a web page with CSS

Daniol Thomas

Daniol Thomas

Updated on 24-Jun-2020 11:39:33

675 Views

You can try to run the following code to center pagination on a web page:ExampleLive Demo                    .demo {             display: inline-block;          }          .demo1 {     ... Read More

Align the grid inside the container using CSS

Daniol Thomas

Daniol Thomas

Updated on 24-Jun-2020 08:37:31

59 Views

You can try to run the following code to align the grid inside the container using the justify-content property:ExampleLive Demo                    .container {             display: grid;             background-color: gray;   ... Read More

How to change the text color of an element in HTML?

Daniol Thomas

Daniol Thomas

Updated on 24-Jun-2020 08:21:37

7K+ Views

Use the color attribute in HTML to display the color of the text.Note − This attribute is not supported in HTML5.ExampleYou can try to run the following code to learn how to implement color attribute in HTML −           HTML Background Colors                                                    This is demo text.                                

Advertisements