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.

            
              <div class="content"> 
  <h1>Pseudo-elements ::before and ::after</h1>
  <h2>with <span>attr(title)</span> for tooltips</h2>
  <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Dolor, iste sed delectus consectetur <a href="#" title="Minimalistic School">minimaillum school in California</a>. Dignissimos, exercitationem ipsam repudiandae adipisci a facere excepturi earum eveniet voluptas tempora sapiente? Rerum, non?</p>
  <p>Quia possimus veritatis velit minus, deserunt non. Quisquam voluptatibus earum culpa harum quasi ut ab nulla voluptate? <a href="#" title="Nothihg compaire">Aspernatur provident explicabo</a> dolorem nobis similique itaque autem animi, reprehenderit deleniti, eos mollitia?</p>
  <p>Ipsa aliquid quibusdam aut non possimus temporibus rem obcaecati, illo nostrum, soluta voluptates cum <a href="#" title="Some Info">ducimus nemo unde</a> delectus magni expedita explicabo, dicta cumque vero quidem! Soluta consectetur architecto ex ipsum.</p>
</div>
<section>
  <div class="content">
    <h1>Pseudo-element ::before</h1>
  <h2>with <span>attr(data-text)</span> for hover-effect</h2>
     <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
    <p>Voluptatum ullam id eligendi esse nihil iusto labore repellat placeat sunt et veniam harum animi maxime doloribus consectetur, vitae, dolorum ea quas!</p>
     <button data-text="Best Offer">Learn More</button>
   </div>
</section>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Montserrat');
*, *:before, *:after {
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}
body {
  margin: 0;  
}
section {
  background-color: #f9f0f1;
  padding: 20px 0;
  margin-bottom: 20px;
}
.content {
  width: 90%;
  margin: 20px auto;
}
span {
  color: #57f;
}

a {
  position:relative; 
  display: inline-block; 
}
a:before {
  content: attr(title);
  display: block;
  min-width: 120px;
  background-color: #000;
  color: #fff;
  padding: 5px 10px;
  text-align: center;
  font-size: 0.9em;
  position:absolute;
  top: -2.1em;
  left: 20%;
  opacity: 0;
  transform: translate(-50px);
  transition: .4s ease-out;
}

a:after {
  content:"";
  display: inline-block;
  border: 8px solid transparent;
  border-top-color: #000; 
  position:absolute;
  top: -2px;
  left: 45%;
  opacity: 0;
  transform: translate(-50px);
  transition: .4s ease-out;
}
a:hover:before, a:hover:after {
  opacity: 1;
  transform: translate(0);
}
button {
  cursor: pointer;
  padding: 10px 20px;
  background-color: #c00;
  color: #fff;
  font-size: 1em;
  border: 1px solid #900;
  border-radius: 6px;
  box-shadow: 2px 2px #600;
  position: relative;
  overflow: hidden;
}
button:before {
  content: attr(data-text);
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: inherit;
  background-color: #600;
  transform: translate(-120%);
  transition: transform .6s;
}
button:hover:before {
  transform: translate(0);
}
            
          
!
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