Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created June 6, 2014 02:19
Show Gist options
  • Select an option

  • Save mikekavouras/7a0696058dafbeaa45f1 to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/7a0696058dafbeaa45f1 to your computer and use it in GitHub Desktop.
function makeItABlackTable() {
var $img = $('img');
var $a = $('<div style="background-color:#181817:width:100%;height:100%;display:table"></div>');
var $b = $('<div style="width:100%;height:100%;display:table-cell;vertical-align:middle"></div>');
$a.append($b);
$b.append($img);
var $body = $('body');
$('body').css('background-color', '#000').append($a);
$img.css('height', '100%');
}
var s = document.createElement('script');
s.setAttribute('src', 'http://code.jquery.com/jquery-latest.min.js');
s.setAttribute('type', 'text/javascript');
s.onload = function() {
makeItABlackTable();
};
document.getElementsByTagName('head')[0].appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment