123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&display=swap" rel="stylesheet">
  <title>Slack From Scratch</title>
</head>

<body>
  <div class="slack-card">
    <div class="header-with-img">
      <div class="name-and-position">
        <div class="name">Florian Kempenich<span class="status"></span></div>
        <div class="position">Professional CSS Beginner</div>
      </div>
    </div>
    <div class="time-and-date">
      <span id="time"></span> local time
    </div>
    <ul class="profile-actions">
      <li class="profile-action">View preferences</li>
      <li class="profile-action">Open account settings</li>
      <li class="profile-action">Edit your profile</li>
      <li class="profile-action">View your files</li>
      <li class="profile-action">Set yourself away</li>
    </ul>
  </div>
  <aside id="thanks">Thank you Rui Costa for all the help with this one</aside>
</body>

</html>
            
          
!
            
              body {
  font-family: "Open Sans", sans-serif;
}

.slack-card {
  margin: 30px;
  border-radius: 6px;
  overflow: hidden;
  width: 300px;
  background: white;
  box-shadow: 2.5px 2.5px 15px -5px grey;
  font-family: "Open Sans", sans-serif;
}

.slack-card > * {
  padding-left: 15px;
}

.header-with-img {
  width: auto;
  height: 210px;
  background-image: linear-gradient(to top, #00000060, #00000000 40%),
    url("https://www.gravatar.com/avatar/e4546dde398d256327e5ebead604f268?s=500");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  position: relative;
}

.name-and-position {
  position: absolute;
  bottom: 10px;
  color: white;
}

.name {
  position: static;
  font-weight: bold;
}

.status {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 7px;
  border-radius: 50%;
  animation: pulse 1s ease-out 0s alternate infinite none running;
}

@keyframes pulse {
  0% {
    background-color: #92d400;
  }

  80% {
    transform: scale(1);
    background-color: #92d400;
  }

  100% {
    transform: scale(1.1);
    background-color: #ace12e;
  }
}

.position {
  font-weight: lighter;
  font-size: 0.8em;
}

.time-and-date {
  height: 30px;
  line-height: 30px;
  font-size: 0.7em;
  font-weight: lighter;
  border-top: solid 1px #f4f4f7;
  border-bottom: solid 1px #f4f4f7;
}

.profile-actions {
  margin: 5px 0 5px 0px;
  padding: 0;
  list-style-type: none;
}

.profile-action {
  padding: 3.5px 0 3.5px 20px;
  font-size: 0.8em;
  cursor: pointer;
}

.profile-action:hover {
  background-color: #f9f9f9;
}

#thanks {
  margin-top: 80px;
  padding-top: 10px;
  border-top: solid 1px lightgrey;
  font-weight: lighter;
  font-size: 0.8em;
}
#thanks aside {
  color: #f4f4f7;
}
            
          
!
            
              function formatAMPM(date) {
  var hours = date.getHours();
  var minutes = date.getMinutes();
  var ampm = hours >= 12 ? "PM" : "AM";
  hours = hours % 12;
  hours = hours ? hours : 12;
  minutes = minutes < 10 ? "0" + minutes : minutes;
  var strTime = hours + ":" + minutes + " " + ampm;
  return strTime;
}

function updateCurrentTime() {
  document.getElementById("time").innerHTML = formatAMPM(new Date());
}

updateCurrentTime();
setInterval(updateCurrentTime, 1000);

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console