How to display an element to the center of the browser
Sometimes you might need to display an element, for example a div, to the center of the browser. Here is an example of how you can do it using JavaScript and CSS.
function init() { // Reference to the element var loading = document.getElementById("loading"); // The div's width, set within the CSS class var loadingWidth = loading.offsetWidth; // The div's width, set within the CSS class var loadingHeight = loading.offsetHeight; // The browser's body's width var documentWidth = document.