JSFiddle - React, Tailwind, and code Playground

by Nate Balcom

HTML

<a href=http://github.com>GitHub</a>
<a href=http://css-tricks.com>CSS-Tricks</a>
<a href=http://www.google.com>Google</a>

CSS

/*
Orig via http://jsfiddle.net/csswizardry/yqdFe/
*/

a { display: block; text-decoration: none; padding: 5px; }

JavaScript

function getDomain(url) {
   return url.match(/:\/\/(.[^/]+)/)[1];
}

$("a[href^='http']").each(function() {
    $(this).css({
        background: "url(http://www.google.com/s2/u/0/favicons?domain=" + getDomain(this.href) + 
        ") left center no-repeat",
        "padding-left": "20px"
    });    
});