Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div class="paper">
  <div class="titleDiv">
    <div class="title">Metropolis Bugle</div>
  </div>
  <hr class="topHr">
  <hr class="bottomHr">
  <div class="aboutTitle">
    <div class="vol"></div>
    <div class="date"></div>
    <div class="price">50&cent</div>
  </div>
  <hr class="dateHr">
  <div class="content">
    <div class="item" id="item1">
      <a class="a1" href="" target="_blank">
        <h4 class="storyTitle1"></h4>
        <p class="by by1"></p><img class="image image1" src="">
        <p class="story story1"></p>
      </a>
    </div>
    <div class="item" id="item2">
      <a class="a2" href="" target="_blank">
        <h4 class="storyTitle storyTitle2"></h4>
        <p class="by by2"></p><img class="image image2" src="">
        <p class="story story2"></p>
      </a>
    </div>
    <div class="item" id="item3">
      <a class=" a3" href="" target="_blank">
        <h4 class="storyTitle storyTitle3"></h4>
        <p class="by by3"></p><img class="image image3" src="">
        <p class="story story3"></p>
      </a>
    </div>
    <div class="item" id="item4">
      <a class="a4" href="" target="_blank">
        <h4 class="storyTitle storyTitle4"></h4>
        <p class="by by4"></p>
        <p class="story story4"></p>
      </a>
    </div>
    <div class="item" id="item5">
      <a class="a5" href="" target="_blank">
        <h4 class="storyTitle storyTitle5"></h4>
        <p class="by by5"></p>
        <p class="story story5"></p>
      </a>
    </div>
    <div class="item" id="item6">
      <a class="a6" href="" target="_blank">
        <h4 class="storyTitle storyTitle6"></h4>
        <p class="by by6"></p>
        <p class="story story6"></p>
      </a>
    </div>
    <div class="item" id="item7">
      <a class="a7" href="" target="_blank">
        <h4 class="storyTitle storyTitle7"></h4>
        <p class="by by7"></p>
        <p class="story story7"></p>
      </a>
    </div>
    <div class="item" id="item8">
      <h4 class="storyTitle weatherTitle">Current Weather</h4>
      <h4 class="story conditions"></h4>
      <p class="story temp"></p>
    </div>
  </div>

  <hr class="dateHr">
</div>
              
            
!

CSS

              
                body {
  background: #487279;
  font-family: "Noto Serif", serif;
  height: 100%;
}

a {
  color: #3a362b;
  text-decoration: none;
}

.paper {
  position: relative;
  width: 800px;
  color: #3a362b;
  border-radius: 2px;
  border-top: 1px dashed rgba(0, 0, 0, 0.5);
  border-bottom: 1px dashed rgba(0, 0, 0, 0.5);
  margin: 20px auto;
  box-sizing: border-box;
  padding-top: 10px;
  padding-bottom: 5px;
  background: rgba(204, 205, 191, 1);
  background: -moz-linear-gradient(
    top,
    rgba(204, 205, 191, 1) 0%,
    rgba(226, 222, 210, 1) 20%,
    rgba(226, 222, 210, 1) 67%,
    rgba(204, 205, 191, 1) 100%
  );
  background: -webkit-gradient(
    left top,
    left bottom,
    color-stop(0%, rgba(204, 205, 191, 1)),
    color-stop(20%, rgba(226, 222, 210, 1)),
    color-stop(67%, rgba(226, 222, 210, 1)),
    color-stop(100%, rgba(204, 205, 191, 1))
  );
  background: -webkit-linear-gradient(
    top,
    rgba(204, 205, 191, 1) 0%,
    rgba(226, 222, 210, 1) 20%,
    rgba(226, 222, 210, 1) 67%,
    rgba(204, 205, 191, 1) 100%
  );
  background: -o-linear-gradient(
    top,
    rgba(204, 205, 191, 1) 0%,
    rgba(226, 222, 210, 1) 20%,
    rgba(226, 222, 210, 1) 67%,
    rgba(204, 205, 191, 1) 100%
  );
  background: -ms-linear-gradient(
    top,
    rgba(204, 205, 191, 1) 0%,
    rgba(226, 222, 210, 1) 20%,
    rgba(226, 222, 210, 1) 67%,
    rgba(204, 205, 191, 1) 100%
  );
  background: linear-gradient(
    to bottom,
    rgba(204, 205, 191, 1) 0%,
    rgba(226, 222, 210, 1) 20%,
    rgba(226, 222, 210, 1) 67%,
    rgba(204, 205, 191, 1) 100%
  );
  filter: progid:DXImageTransform.Microsoft.gradient(
      startColorstr="#cccdbf",
      endColorstr="#cccdbf",
      GradientType=0
    );
  -webkit-box-shadow: 0px 3px 20px 0px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 0px 3px 20px 0px rgba(0, 0, 0, 0.75);
  box-shadow: 0px 3px 20px 0px rgba(0, 0, 0, 0.75);
}

.titleDiv {
  position: relative;
  background-image: url("http://www.jarrodyellets.com/images/globe.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.title {
  text-align: center;
  font-size: 4em;
  text-align: center;
  font-family: "Gravitas One", cursive;
  margin-bottom: 10px;
  line-height: 2;
  text-shadow: 4px 3px 0px #cccdbf, 9px 8px 0px rgba(0, 0, 0, 0.15);
}

.topHr {
  border: 3px solid #3a362b;
  margin-top: 0;
  margin-bottom: 3px;
}

.bottomHr {
  border: 1px solid #3a362b;
  margin: 0;
}

.aboutTitle {
  position: relative;
  text-transform: uppercase;
  font-family: "News Cycle", sans-serif;
  font-size: 14px;
  font-weight: bold;
}

.vol {
  position: absolute;
  left: 5%;
}

.date {
  text-align: center;
}

.price {
  position: absolute;
  right: 5%;
  top: 0;
}

.dateHr {
  border: 2px solid #3a362b;
  margin-top: 2px;
  margin-bottom: 0;
}

.content {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
}

.item {
  padding: 5px;
}

.storyTitle {
  font-family: "Oswald", sans-serif;
  padding: 0 5%;
  margin: 0;
  font-size: 20px;
}

.storyTitle1 {
  text-align: center;
  font-size: 3em;
  font-family: "Oswald", sans-serif;
  margin: 0;
  padding: 0 5%;
}

.storyTitle2 {
  font-size: 2.5em;
}

.storyTitle3 {
  font-size: 24px;
}

.weatherTitle {
  font-size: 30px;
}

.story {
  padding: 0 5%;
  font-size: 14px;
}

.by {
  font-size: 11px;
  padding: 0 5%;
  font-weight: bold;
  text-transform: uppercase;
}

.image {
  display: block;
  width: 90%;
  margin: 0 auto;
  border: solid 2px black;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.6;
  filter: grayscale(50%);
}

.image3 {
  margin-top: 10px;
}

#item1 {
  grid-column: 1 / span 3;
  border-bottom: 1px solid #474342;
}

#item2 {
  grid-column: 1 / span 2;
  grid-row: 2;
}

#item3 {
  grid-column: 3;
  grid-row: 2 / 3;
  border-left: 1px solid #474342;
}

#item4 {
  border-right: 1px solid #474342;
}

#item6 {
  grid-column: 3;
  grid-row: 3 / 4;
  border-left: 1px solid #474342;
}

#item7 {
  grid-column: 2 / span 2;
  border-top: 1px solid #474342;
}

#item8 {
  grid-column: 1 / span 1;
  grid-row: 4;
  border-top: 1px solid #474342;
  border-right: 1px solid #474342;
  text-align: center;
}

.temp,
.conditions {
  font-size: 24px;
  font-weight: bold;
  margin: 5px;
}

@media (max-width: 850px) {
  .paper {
    width: 90vw;
    margin: none;
  }

  .aboutTitle {
    font-size: 12px;
  }

  .title {
    line-height: 1;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 10px;
  }

  .aboutTitle {
    font-size: 10px;
  }

  .content {
    grid-template-rows: repeat(min-content, 1fr);
  }

  #item1,
  #item2,
  #item3,
  #item4,
  #item5,
  #item6,
  #item7,
  #item8 {
    grid-column: 1 / -1;
    grid-row: span 1;
    border: none;
  }
}

              
            
!

JS

              
                $(document).ready(function() {
  const apiKey = "837cfdfc79654129a9a0d4de5cb1d577";
  const apiUrl = "https://newsapi.org/v2/top-headlines?country=us&";
  let newsArr = [];
  let count = 1;
  let index;
  let lat;
  let long;
  let temp;
  let conditions;
  let date = new Date();
  let startDate = new Date("1981-05-24");
  let milisec = date.getTime() - startDate.getTime();
  let volNum = Math.round(milisec / (1000 * 60 * 60 * 24));
  let currDate = date.toDateString();

  getData();
  getLocation();

  function getData() {
    $.ajax({
      type: "GET",
      url: apiUrl + "apiKey=" + apiKey,
      datatype: "jsonp",
      success: function(data) {
        newsArr.push(data);
        insertData();
      }
    });
  }

  function insertData() {
    $(".date").append(currDate);
    $(".vol").append("Vol# " + volNum);
    for (let i = 1; i < newsArr[0].articles.length; i++) {
      index = i - 1;
      let news = newsArr[0].articles[index];
      if (news.description && news.source.id != "fox-news") {
        if (count < 4 && news.urlToImage) {
          $(".image" + count).attr("src", news.urlToImage);
          printData(news);
        } else if (count >= 4) {
          printData(news);
        }
        if (count === 8) {
          return true;
        }
      }
    }
  }

  function printData(news) {
    $(".storyTitle" + count).append(news.title);
    $(".story" + count).append(news.description);
    $(".by" + count).append("By: " + news.source.name);
    $(".a" + count).attr("href", news.url);
    count++;
  }

  function getLocation() {
    $.ajax({
      type: "GET",
      url: "https://extreme-ip-lookup.com/json/",
      success: function(data) {
        long = data.lon;
        lat = data.lat;
        getWeather();
      }
    });
  }

  function getWeather() {
    $.ajax({
      type: "GET",
      url:
        "https://api.darksky.net/forecast/3a616888226060540aaa82c98bfacdb9/" +
        lat +
        "," +
        long,
      dataType: "jsonp",
      success: function(data) {
        showWeather(data);
      }
    });
  }

  function showWeather(data) {
    conditions = data.currently.summary;
    temp = Math.round(data.currently.apparentTemperature);
    $(".conditions").append(conditions);
    $(".temp").append(temp + String.fromCharCode(176) + "F");
  }
});

              
            
!
999px

Console