Link Icon to External Sites

In this example below you will see how to do a Link Icon to External Sites with some HTML / CSS and Javascript

A style for links to external sites

This awesome code was written by mdd, you can see more from this user in the personal repository.
You can find the original code on
Copyright mdd ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>Link Icon to External Sites</title>
      <link rel="stylesheet" href="css/style.css">



  <p>I'm a sentence and I include both <a href="">internal links</a> and <a href="">external links</a> but the external links are easy to visually identify because they've got a little arrow.</p>



/*Downloaded from */
body { margin: 1em; }

a, a:visited { color: blue; text-decoration: none; }

a:hover { border-bottom: 1px solid; }

a[href*="//"]:not([href*=""]) {
  /* external link styles, use :before or :after if you want! */
  color: coral;

/* Style for links to external sites */
a[href*="//"]:not([href*=""]):after {
  content: "\21B8";
  /* display has to be inline-block or block to transform psuedo-elements */
  display: inline-block;
  position: relative;
  font-size: 0.6em;
  vertical-align: super;
  margin-left: -0.1em;
  transform: scale(-1, 1);