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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              @import url("https://fonts.googleapis.com/css?family=Montserrat:400,400i,700")
html
  background-color: #202020
  body
    margin: 0
    
.c
  background-color: #1a1a1a
  box-shadow: inset 0 0 30px rgba(0,0,0,0.3)
  border: 1px solid #333333
  border-radius: 4px
  padding: 3vh
  position: absolute
  transform: translate(-50%, -50%)
  top: 50%
  left: 50%
  .n
    margin-bottom: 2vh
    color: #262626
    font-size: 26px
    font-weight: 700
    font-family: 'Montserrat', arial
  .p
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)
    background: linear-gradient(#333333, #1a1a1a)
    border-radius: inherit
    padding: 3vh
    .tc
      display: flex
    .t
      font-family: 'Montserrat', arial
      font-size: 16px
      transition: background 0.1s, padding 0.5s
      background: #1a1a1a
      color: #666666
      padding: 2vh
      border-bottom: 1px solid #666666
      cursor: pointer
      &:nth-child(1)
        border-top-left-radius: 4px
      &:nth-last-child(1)
        border-top-right-radius: 4px
    .ta
      transition: background 0.1s, padding 0.5s
      background: linear-gradient(#404040, transparent)
      border-bottom: 0
      margin-bottom: 2px
      color: #999999
      padding: 2vh 3vh 2vh 3vh
    .m
      display: block
      padding: 2vh
      background: linear-gradient(transparent, #1a1a1a)
      border-bottom: 1px solid #666666
      border-bottom-right-radius: 4px
      border-bottom-left-radius: 4px
      .ip
        display: none
        width: 100%
        .ti
          color: #999999
          background-color: rgba(255,255,255,0.1)
          padding: 2vh
          font-family: 'Montserrat', arial
          box-shadow: 0 0 10px rgba(0,0,0,0.05)
        .in
          color: #666666
          border: 1px solid rgba(255,255,255,0.1)
          margin-top: 1.5vh
          padding: 2vh
          font-family: 'Montserrat', arial
          font-size: 14px
          
            
          
!
            
              gap = 1.25 //This is the free space after the last tab.

tabs = ["Home","Service","Jobs","About","Test"] //Add more tabs here.

title = ["Welcome to Metro Tabs.",
         "Here are our services.",
         "Interested in a job?",
         "A little about us.",
         "This is a test."] // Add titles for the tabs here.

info = ["Metro Tabs is an example of how a Basic Dynamic JQuery Tab Menu can be constructed.",
        "Well honestly, they are pretty good.. hehe",
        "Oh, you're interested in a job? That's weird, me too!",
        "In west Philadelphia born and raised. On the playground where I spent most of my days. Chilling out, maxing, relaxing all cool",
        "Yeah, this tab is actually just a test, sorry :/"
] // Add more info here.

init = () => {
  gTabs()
  $(".t:nth-child(1)").addClass("ta")
  $(".ti").text(title[0])
  $(".in").text(info[0])
  $(".ip:nth-child(1)").fadeIn(400)
}

gTabs = () => {
  for (i=0; i<tabs.length; i++) {
    $(".tc").append("<div class='t'></div>")
  }
  $(".t").each(function(i) {
    $(this).text(tabs[i])
    $(".m").append("<div class='ip'><div class='ti'></div><div class='in'></div></div>")
  })
  dWidth()
}

dWidth = () => {
  var TCW = $(".tc").width()
  $(".in").css("width", TCW*gap+"px")
}

init()

$(".t").click(function() {
  $(".t").removeClass("ta")
  $(this).addClass("ta")
  
  $(".ip").fadeOut(200).delay(200)
  
  var cS = $(this).text()
  for (i=0; i<tabs.length; i++) {
    if (cS == tabs[i]) {
      p = i
      b = i+1
    }
  }
  
  $(".ip:nth-child("+b+") .ti").text(title[p])
  $(".ip:nth-child("+b+") .in").text(info[p])
  $(".ip:nth-child("+b+")").fadeIn(200)
  
})
            
          
!
999px
Loading ..................

Console