Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <div class="title">
    <h1>Shakespearean Insult Generator</h1>
  </div>
  <div class="speech-bubble">
    <p id="result"></p>
  </div>

  <div class="william">
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="168px" height="198px" viewBox="-0.5 -0.5 168 198">
          <defs>
            <linearGradient
              x1="0%"
              y1="0%"
              x2="0%"
              y2="100%"
              id="mx-gradient-e6e6e6-1-e6e6e6-1-s-0"
            >
              <stop offset="0%" style="stop-color:#E6E6E6" />
              <stop offset="100%" style="stop-color:#E6E6E6" />
            </linearGradient>
            <linearGradient
              x1="0%"
              y1="0%"
              x2="0%"
              y2="100%"
              id="mx-gradient-994c00-1-663300-1-s-0"
            >
              <stop offset="0%" style="stop-color:#994C00" />
              <stop offset="100%" style="stop-color:#663300" />
            </linearGradient>
            <linearGradient
              x1="0%"
              y1="0%"
              x2="100%"
              y2="0%"
              id="mx-gradient-ffe599-1-fff2cc-1-e-0"
            >
              <stop offset="0%" style="stop-color:#FFE599" />
              <stop offset="100%" style="stop-color:#FFF2CC" />
            </linearGradient>
            <linearGradient
              x1="0%"
              y1="0%"
              x2="0%"
              y2="100%"
              id="mx-gradient-ffcccc-1-ffe599-1-s-0"
            >
              <stop offset="0%" style="stop-color:#FFCCCC" />
              <stop offset="100%" style="stop-color:#FFE599" />
            </linearGradient>
          </defs>
          <g>
            <path
              d="M 46 83 Q 127 83 127 142 Q 127 201 46 201 Q 86.5 142 46 83 Z"
              fill="url(#mx-gradient-e6e6e6-1-e6e6e6-1-s-0)"
              stroke="#cccccc"
              stroke-width="3"
              stroke-miterlimit="10"
              transform="rotate(-76,86.5,142)"
              pointer-events="none"
            />
            <path
              d="M 41 7 L 64.3 66.94 C 65.42 69.83 66 72.9 66 76 C 66 82.63 63.37 88.99 58.68 93.68 C 53.99 98.37 47.63 101 41 101 C 34.37 101 28.01 98.37 23.32 93.68 C 18.63 88.99 16 82.63 16 76 C 16 72.9 16.58 69.83 17.7 66.94 Z"
              fill="url(#mx-gradient-994c00-1-663300-1-s-0)"
              stroke="none"
              transform="rotate(22,41,54)"
              pointer-events="none"
            />
            <path
              d="M 124 7 L 147.3 66.94 C 148.42 69.83 149 72.9 149 76 C 149 82.63 146.37 88.99 141.68 93.68 C 136.99 98.37 130.63 101 124 101 C 117.37 101 111.01 98.37 106.32 93.68 C 101.63 88.99 99 82.63 99 76 C 99 72.9 99.58 69.83 100.7 66.94 Z"
              fill="url(#mx-gradient-994c00-1-663300-1-s-0)"
              stroke="none"
              transform="translate(124,0)scale(-1,1)translate(-124,0)rotate(24,124,54)"
              pointer-events="none"
            />
            <ellipse
              cx="82"
              cy="70"
              rx="70"
              ry="47"
              fill="url(#mx-gradient-ffe599-1-fff2cc-1-e-0)"
              stroke="none"
              transform="rotate(-90,82,70)"
              pointer-events="none"
            />
            <path
              d="M 69.81 79 C 66.51 81.25 65 87.27 66.43 92.45 C 67.87 97.63 71.7 100 75 97.75 C 72.41 97.05 70.23 94.35 69.18 90.57 C 68.14 86.8 68.37 82.45 69.81 79 Z"
              fill="#663300"
              stroke="#000000"
              stroke-miterlimit="10"
              transform="rotate(-79,70,89.5)"
              pointer-events="none"
            />
            <path
              d="M 82.5 117 C 65 126.96 65 142.04 82.5 152 C 100 142.04 100 126.96 82.5 117 Z"
              fill="#663300"
              stroke="none"
              pointer-events="none"
            />
            <path
              d="M 69.5 64 L 97.5 64 L 97.5 64 L 69.5 64 L 69.5 70 L 69.5 70 Z"
              fill="#ffffff"
              stroke="#000000"
              stroke-miterlimit="10"
              transform="rotate(-90,83.5,67)"
              pointer-events="none"
            />
            <path
              d="M 64.33 26 C 61.36 29.43 60 38.61 61.29 46.49 C 62.58 54.38 66.03 58 69 54.57 C 66.67 53.5 64.7 49.39 63.76 43.64 C 62.82 37.88 63.03 31.25 64.33 26 Z"
              fill="#000000"
              stroke="#000000"
              stroke-miterlimit="10"
              transform="rotate(124,64.5,42)"
              pointer-events="none"
            />
            <ellipse
              cx="67"
              cy="58"
              rx="5"
              ry="5"
              fill="#000000"
              stroke="#000000"
              pointer-events="none"
            />
            <ellipse
              cx="96"
              cy="58"
              rx="5"
              ry="5"
              fill="#000000"
              stroke="#000000"
              pointer-events="none"
            />
            <path
              d="M 77.5 92 Q 87.5 92 87.5 105 Q 87.5 118 77.5 118 Q 82.5 105 77.5 92 Z"
              fill="#000000"
              stroke="#ff0000"
              stroke-width="3"
              stroke-miterlimit="10"
              transform="rotate(-90,82.5,105)"
              pointer-events="none"
              class="mouth"
            />
            <ellipse
              cx="101"
              cy="77"
              rx="7.000000000000001"
              ry="7.000000000000001"
              fill="url(#mx-gradient-ffcccc-1-ffe599-1-s-0)"
              stroke="none"
              pointer-events="none"
            />
            <ellipse
              cx="62"
              cy="77"
              rx="7.000000000000001"
              ry="7.000000000000001"
              fill="url(#mx-gradient-ffcccc-1-ffe599-1-s-0)"
              stroke="none"
              pointer-events="none"
            />
            <path
              d="M 93.81 79 C 90.51 81.25 89 87.27 90.43 92.45 C 91.87 97.63 95.7 100 99 97.75 C 96.41 97.05 94.23 94.35 93.18 90.57 C 92.14 86.8 92.37 82.45 93.81 79 Z"
              fill="#663300"
              stroke="#000000"
              stroke-miterlimit="10"
              transform="translate(94,0)scale(-1,1)translate(-94,0)rotate(-80,94,89.5)"
              pointer-events="none"
            />
            <path
              d="M 99.33 27 C 96.36 30.43 95 39.61 96.29 47.49 C 97.58 55.38 101.03 59 104 55.57 C 101.67 54.5 99.7 50.39 98.76 44.64 C 97.82 38.88 98.03 32.25 99.33 27 Z"
              fill="#000000"
              stroke="#000000"
              stroke-miterlimit="10"
              transform="translate(0,43)scale(1,-1)translate(0,-43)rotate(-60,99.5,43)"
              pointer-events="none"
            />
          </g>
        </svg>
  </div>

  <div class="controls">
    <button id="randomise" name="randomise">
          Clicketh for a new insult
        </button>
  </div>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=MedievalSharp|Tangerine");
body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.container {
  width: 700px;
  height: 500px;
  display: grid;
  grid-template-rows: 1fr 2fr 2fr;
  grid-template-columns: 2fr 1fr;
  grid-gap: 0;
}

.title {
  grid-column: 1/3;
  grid-row: 1/2;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: MedievalSharp, Georgia, "Times New Roman", Times, serif;
}

h1 {
  font-size: 36px;
  padding: 5px;
  color: #333;
}

.speech-bubble {
  grid-column: 1/2;
  grid-row: 2/3;
  text-align: center;
  background: antiquewhite;
  border-radius: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.speech-bubble::after {
  content: "";
  border-right: 50px solid antiquewhite;
  border-bottom: 50px solid transparent;
  border-left: 50px solid transparent;

  position: absolute;
  bottom: 0;
  left: 70%;
  width: 0;
  height: 0;
  margin-bottom: -50px;
}

.william {
  grid-column: 2/3;
  grid-row: 3/4;
  padding: 5px;
  background: white;
}

.mouth {
  stroke-width: 2;
  transition: all 0.3s ease-in-out;
}

.william:hover .mouth {
  stroke-width: 1;
}

.controls {
  grid-column: 1/2;
  grid-row: 3/4;
  padding: 5px;
  text-align: center;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

button {
  font-family: MedievalSharp, Georgia, "Times New Roman", Times, serif;
  font-size: 24px;
  border: none;
  padding: 5px;
  width: 300px;
  height: 50px;
  border-radius: 30px;
  background: tomato;
  color: #333;
  transition: all 0.2s ease-in-out;
  box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.3);
}

button:hover,
button:focus {
  border: 1px dotted #333;
  box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.1);
}

#result {
  font-size: 40px;
  font-family: Tangerine, Georgia, "Times New Roman", Times, serif;
  color: #333;
}

              
            
!

JS

              
                var ins1;
var ins2;
var ins3;
ins1 = [
  "artless",
  "bawdy",
  "beslubbering",
  "bootless",
  "churlish",
  "cockered",
  "clouted",
  "craven",
  "currish",
  "dankish",
  "dissembling",
  "droning",
  "errant",
  "fawning",
  "fobbing",
  "froward",
  "frothy",
  "gleeking",
  "goatish",
  "gorbellied",
  "impertinent",
  "infectious",
  "jarring",
  "loggerheaded",
  "lumpish",
  "mammering",
  "mangled",
  "mewling",
  "paunchy",
  "pribbling",
  "puking",
  "puny",
  "qualling",
  "rank",
  "reeky",
  "rougish",
  "ruttish",
  "saucy",
  "spleeny",
  "spongy",
  "surly",
  "tottering",
  "unmuzzled",
  "vain",
  "venomed",
  "villainous",
  "warped",
  "wayward",
  "weedy",
  "yeasty"
];
ins2 = [
  "base-court",
  "bat-fowling",
  "beef-witted",
  "beetle-headed",
  "boil-brained",
  "clapper-clawed",
  "clay-brained",
  "common-kissing",
  "crook-pated",
  "dismal-dreaming",
  "dizzy-eyed",
  "doghearted",
  "dread-bolted",
  "earth-vexing",
  "elf-skinned",
  "fat-kidneyed",
  "fen-sucked",
  "flap-mouthed",
  "fly-bitten",
  "folly-fallen",
  "fool-born",
  "full-gorged",
  "guts-griping",
  "half-faced",
  "hasty-witted",
  "hedge-born",
  "hell-hated",
  "idle-headed",
  "ill-breeding",
  "ill-nurtured",
  "knotty-pated",
  "milk-livered",
  "motley-minded",
  "onion-eyed",
  "plume-plucked",
  "pottle-deep",
  "pox-marked",
  "reeling-ripe",
  "rough-hewn",
  "rude-growing",
  "rump-fed",
  "shard-borne",
  "sheep-biting",
  "spur-galled",
  "swag-bellied",
  "tardy-gaited",
  "tickle-brained",
  "toad-spotted",
  "unchin-snouted",
  "weather-bitten"
];
ins3 = [
  "apple-john",
  "baggage",
  "barnacle",
  "bladder",
  "boar-pig",
  "bugbear",
  "bum-bailey",
  "canker-blossom",
  "clack-dish",
  "clotpole",
  "coxcomb",
  "codpiece",
  "death-token",
  "dewberry",
  "flap-dragon",
  "flax-wench",
  "flirt-gill",
  "foot-licker",
  "fustilarian",
  "giglet",
  "gudgeon",
  "haggard",
  "harpy",
  "hedge-pig",
  "horn-beast",
  "hugger-mugger",
  "joithead",
  "lewdster",
  "lout",
  "maggot-pie",
  "malt-worm",
  "mammet",
  "measle",
  "minnow",
  "miscreant",
  "moldwarp",
  "mumble-news",
  "nut-hook",
  "pigeon-egg",
  "pignut",
  "puttock",
  "pumpion",
  "ratsbane",
  "scut",
  "skainsmate",
  "strumpet",
  "varlot",
  "vassal",
  "whey-face",
  "wagtail"
];

var randomNumber1 = 0;
var randomNumber2 = 0;
var randomNumber3 = 0;

function randomGenerator() {
  randomNumber1 = 1 + Math.floor(Math.random() * ins1.length);
  randomNumber2 = 1 + Math.floor(Math.random() * ins2.length);
  randomNumber3 = 1 + Math.floor(Math.random() * ins3.length);
}

$(document).ready(function() {
  randomGenerator();
  $("#result").text(
    "Thou " +
      ins1[randomNumber1 - 1] +
      ", " +
      ins2[randomNumber2 - 1] +
      " " +
      ins3[randomNumber3 - 1] +
      "!"
  );

  $("#randomise").click(function() {
    randomGenerator();
    $("#result").text(
      "Thou " +
        ins1[randomNumber1 - 1] +
        ", " +
        ins2[randomNumber2 - 1] +
        " " +
        ins3[randomNumber3 - 1] +
        "!"
    );
  });
});

              
            
!
999px

Console