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 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

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

              
                <!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">
  <title>Basic Style Example</title>
</head>

<body>
  <h1>What is CSS?</h1>

  <p>CSS lets us take our boring pages and make them more exciting by adding <span class="bold">colour</span> and <span class="italic">style</span>.</p>

  <h2>What can we do?</h2>
  <p>With this ability to style things, we can control absoluetly every visual aspect of the page, even overriding the built in behaviour of various HTML elements.</p>

  <p>We can take something like a <button>button</button></p>

  <p>And turn it into something a bit more <button class="fancy">Interesting</button></p>
  
 <div id="messages">
   
   <div>
     <div class="message">
    <img src="https://www.fillmurray.com/50/50" alt="Fill Murray" class="avatar">
    <div class="content-container">
      <p class="content">We can apply complex styles to things to make them much more visually appealing</p>
    <p class="content">This is important in today's modern web. Users want to interact with sites that feel premium, look great, and run like a dream.</p>
    <p class="content">A large part of the premium experience comes from outstanding visual presentation</p>
    </div>
  </div>
   
   <div class="message">
    <img src="https://www.placecage.com/50/50" alt="Fill Murray" class="avatar">
    <div class="content-container">
      <p class="content">Wow thanks, great to know!</p>
    </div>
  </div>
   </div>
   
  </div>
  
  
  

</body>

</html>
              
            
!

CSS

              
                body {
  font-family: sans-serif;
  background-color: #2c3e50;
  color: #ecf0f1;
}

.italic {
  font-style: oblique;
  color: #1abc9c;
}

.bold {
  font-weight: bold;
  color: #9b59b6;
}

p {
  color: #bdc3c7;
}

button.fancy {
  background: #e67e22;
  padding: 5px 15px;
  border: 1px solid #e67e22;
  color: #ecf0f1;
  border-radius: 3px;
  transition: background 0.2s ease-in-out;
  cursor: pointer;
}

button.fancy:hover {
  background: #d35400;
  border-color: #e74c3c;
}

.message {
  display: flex;
  align-items: flex-end;
  margin: 15px 0;
}

.avatar {
  border-radius: 100%;
  height: 50px;
}

.content-container {
  display: flex;
  flex-direction: column;
}

.content {
  background: #9b59b6;
  color: #ecf0f1;
  padding: 15px;
  border-radius: 25px;
  border-bottom-left-radius: 5px;
  border-top-left-radius: 5px;
  margin: 2px 10px;
  max-width: 450px;
}

.content:first-child {
  border-top-left-radius: 25px;
}

.content:last-child {
  border-bottom-left-radius: 25px;
}

#messages {
  background: #ecf0f1;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.message:nth-child(even) {
  flex-direction: row-reverse;
}

.message:nth-child(even) .content {
  color: #ecf0f1;
  background: #3498db;
}

#messages>div {
  max-width: 700px;
}
              
            
!

JS

              
                
              
            
!
999px

Console