cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              .container
  .content
    h1 Pure CSS Tooltips
    h2 Tooltips on Divs
    .row
      .col-sm-3.col-xs-6.text-center
        .t-top.t-sm.bordered(data-tooltip='Top Tooltip') Div
      .col-sm-3.col-xs-6.text-center
        .t-right.t-sm.bordered(data-tooltip='Right Tooltip') Div
      .col-sm-3.col-xs-6.text-center
        .t-bottom.t-md.bordered(data-tooltip='Bottom Tooltip') Div
      .col-sm-3.col-xs-6.text-center
        .t-left.t-sm.bordered(data-tooltip='Left Tooltip') Div
            
    h2 Tooltips on Buttons
    .row
      .col-sm-3.col-xs-6.text-center
        button.t-top.t-sm.btn.btn-block.btn-success(data-tooltip='Top Tooltip') Button
      .col-sm-3.col-xs-6.text-center
        button.t-right.t-sm.btn.btn-block.btn-primary(data-tooltip='Right Tooltip') Button
      .col-sm-3.col-xs-6.text-center
        button.t-bottom.t-md.btn.btn-block.btn-danger(data-tooltip='Bottom Tooltip') Button
      .col-sm-3.col-xs-6.text-center
        button.t-left.t-sm.btn.btn-block.btn-warning(data-tooltip='Left Tooltip') Button
            
    h2 Tooltips on Inputs
    .row
      .col-sm-3.col-xs-6.text-center
        .t-top.t-sm.full-width(data-tooltip='Top Tooltip')
          input.form-control.text-center(placeholder='Input')
      .col-sm-3.col-xs-6.text-center
        .t-right.t-sm.full-width(data-tooltip='Right Tooltip')
          input.form-control.text-center(placeholder='Input')
      .col-sm-3.col-xs-6.text-center
        .t-bottom.t-md.full-width(data-tooltip='Bottom Tooltip')
          input.form-control.text-center(placeholder='Input')
      .col-sm-3.col-xs-6.text-center
        .t-left.t-sm.full-width(data-tooltip='Left Tooltip')
          input.form-control.text-center(placeholder='Input')
              
    h2 Tooltips on Links
    p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi viverra augue quis consequat viverra. Sed pulvinar lacus urna. Nullam sed nisl semper, elementum nisl eu, semper ex. Vestibulum bibendum at neque id dictum. <a href="#" class="t-bottom t-md" data-tooltip="Bottom Tooltip">Maecenas</a> at magna semper, malesuada libero faucibus, eleifend mauris. Nullam dignissim blandit justo, nec dictum risus dapibus at. In hac habitasse platea dictumst. Praesent nec nulla ullamcorper, commodo tellus id, consectetur metus. In euismod augue lectus, vitae pretium tortor auctor suscipit.

    p Sed vulputate luctus metus sed varius. Aliquam auctor lobortis ante, nec dignissim sem sodales at. Sed sed dolor ex. Curabitur pharetra, nibh ut aliquam varius, nisl mi vulputate diam, eget scelerisque odio felis sed justo. Suspendisse odio ligula, semper ac dui vitae, hendrerit hendrerit felis. Ut vel rutrum nunc, sit amet euismod turpis. Suspendisse quis nisl consectetur, ullamcorper lacus non, euismod mi. Proin nec justo vel libero semper malesuada pellentesque eget sem. <a href="#" class="t-top t-sm" data-tooltip="Top Tooltip">Quisque</a> et lacus a dolor fermentum vestibulum ut non neque. Vivamus iaculis sodales interdum. Aliquam pretium tempor erat vel posuere. Nam tellus diam, ultricies at sollicitudin ut, hendrerit id quam. In viverra elementum ex nec congue.
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700')
@import url('https://fonts.googleapis.com/css?family=Pacifico')

body
  background-color: #e0e0e0
  font-family: 'Open Sans', sans-serif
  font-size: 14px
  line-height: 21px
  padding: 15px 0

.content
  background: #fff
  border-radius: 3px
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075), 0 2px 4px rgba(0, 0, 0, 0.0375)
  padding: 30px

h1
  color: #333
  font-family: 'Pacifico', cursive
  font-size: 28px
  line-height: 42px
  margin: 0 0 15px
  text-align: center

h2
  border-bottom: 1px solid #ddd
  color: #aaa
  font-size: 12px
  line-height: 24px
  margin: 0 0 15px
  padding: 0
  position: relative
  text-align: center

a
  color: red !important
  font-weight: bold

div[class^="col"]
  margin-bottom: 25px

.bordered
  background: #e2e2e2
  border: 1px solid #ccc
  padding: 5px 10px

.full-width
  width: 100%

[data-tooltip]
  cursor: pointer
  position: relative
  
  &:before, &:after
    position: absolute
    visibility: hidden
    opacity: 0
    pointer-events: none
    transition: all .15s cubic-bezier(.5, 1, .25, 1)
    z-index: 1
  
  &:before
    padding: 5px
    width: 110px
    border-radius: 3px
    background: #000
    color: #fff
    content: attr(data-tooltip)
    text-align: center
    font-size: 14px
    font-weight: normal
    line-height: 1.2
  
  &:after
    border: 8px solid transparent
    width: 0
    content: ""
    font-size: 0
    line-height: 0
  
  /********** Default Behavior **********/
  &:hover:before, &:hover:after
    visibility: visible
    opacity: 1
  
  /********** Timeout Variant **********/
  //@keyframes timeout
    0%
      opacity: 1
      visibility: visible
    99%
      opacity: 1
      visibility: visible
    100%
      opacity: 0
      visibility: hidden
  
  //&:hover:before, &:hover:after
    animation: timeout 2s
  
  /********** Tooltip Sizes **********/
  &.t-xl:before
    width: 200px
  
  &.t-lg:before
    width: 170px
  
  &.t-md:before
    width: 140px
  
  &.t-sm:before
    width: 110px
  
  &.t-xs:before
    width: 80px
  
  /********** Top Tooltip **********/
  &.t-top
    
    &:before
      bottom: 100%
      left: 50%
      margin-bottom: 5px
      transform: translateX(-50%)
    
    &:after
      bottom: 100%
      left: 50%
      transform: translateX(-50%)
      border-top: 8px solid #000
      border-bottom: none
    
    &:hover:before, &:hover:after
      transform: translateX(-50%) translateY(-5px)
    
  /********** Right Tooltip **********/
  &.t-right
    
    &:before
      top: 50%
      left: 100%
      margin-left: 5px
      transform: translateY(-50%)
    
    &:after
      top: 50%
      left: 100%
      transform: translateY(-50%)
      border-right: 8px solid #000
      border-left: none
    
    &:hover:before, &:hover:after
      transform: translateX(5px) translateY(-50%)
  
  /********** Bottom Tooltip **********/
  &.t-bottom
    
    &:before
      top: 100%
      left: 50%
      margin-top: 5px
      transform: translateX(-50%)
    
    &:after
      top: 100%
      left: 50%
      transform: translateX(-50%)
      border-bottom: 8px solid #000
      border-top: none
    
    &:hover:before, &:hover:after
      transform: translateX(-50%) translateY(5px)
  
  /********** Left Tooltip **********/
  &.t-left
    
    &:before
      top: 50%
      right: 100%
      margin-right: 5px
      transform: translateY(-50%)
    
    &:after
      top: 50%
      right: 100%
      transform: translateY(-50%)
      border-left: 8px solid #000
      border-right: none
    
    &:hover:before, &:hover:after
      transform: translateX(-5px) translateY(-50%)
            
          
!
            
              /*
No JS Required

Example HTML:
<div class="t-top t-sm" data-tooltip="XXX">XXX</div>

Simply choose your preferred Content, Alignment, and Size.

Content:
  * data-tooltip='XXX'
  
Alignment:
  * Top = t-top
  * Right = t-right
  * Bottom = t-bottom
  * Left = t-left
  
Size:
  * Extra Small = t-xs
  * Small = t-sm
  * Medium = t-md
  * Large = t-lg
  * Extra Large = t-xl
*/
            
          
!
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.
Loading ..................

Console