title: I've got code to randomize an image on refresh in javascript and CSS to format the image but I don't know how to combine the two
body: <p>I'm sorry if the title doesn't make sense, I'm extremely new to this, so here's a jsfiddle of what I'm talking about: <a href="https://jsfiddle.net/a3668a1f/1/" rel="nofollow noreferrer">https://jsfiddle.net/a3668a1f/1/</a></p>
  
  <p>I want the images that show up below the title box to appear in the title box.</p>
  
  <p>I just threw those images in there as an example.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var images = [
    "https://i.redd.it/1ev9elr85xcz.jpg",
    "https://i.redd.it/g6kc3upsvqdz.jpg",
    "https://i.redd.it/koucki3aygdz.jpg"
  ];
  
  function randImg() {
    var size = images.length
    var x = Math.floor(size * Math.random())
    document.getElementById('image').src = images[x];
  }
  
  randImg();</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>h1 {
    color: silver;
    text-align: center;
    max-width: 100%;
    vertical-align: middle;
    line-height: 85px;
    height: 100px;
    border: solid;
    border-color: silver;
    border-radius: 25px;
    border-width: 5px;
    background-position: center;
    background-repeat: no-repeat;
    background-image: url(https://i.redd.it/pvqzvajftpdz.jpg);
    background-size: cover;
    box-sizing: border-box;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;h1&gt; Title.
      &lt;img id="image" /&gt;
    &lt;/h1&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>