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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                //- source at https://github.com/bevacqua/untab

div.tv-tabs
  label.tv-tab(for='tv-tab-1') Intro
  label.tv-tab(for='tv-tab-2') Code
  label.tv-tab(for='tv-tab-3') ?

input.tv-radio#tv-tab-1(name='tv-group', type='radio', checked)
div.tv-content
  h1 Intro
  p These are some awesome tabs!
  ul
    li No JavaScript
    li 100% Healthy, Plain CSS
    li Barely any hackery
    li Kind of verbose, HTML-wise...
  p
    | Check out the 
    label.tv-link(for='tv-tab-2') source code
    | !
input.tv-radio#tv-tab-2(name='tv-group', type='radio')
div.tv-content
  h1 Code
  p="Kind of verbose, here is the Jade source. Most JS libraries still ask for similar markup that's hardly any better, though."
  h3 HTML (Jade) Code:
  pre
    code
      | div.tv-tabs
      |   label.tv-tab(for='tv-tab-1') Tab Name!
      |   label.tv-tab(for='tv-tab-n') for attr equals the radio ids
      | 
      | input.tv-radio#tv-tab-1(name='any-group-name', type='radio', checked)
      | div.tv-content Content goes here!
      | 
      | input.tv-radio#tv-tab-n(name='any-group-name', type='radio')
      | div.tv-content More goes here!
  h3 Relevant CSS (Stylus) Code:
  pre
    code
      | .tv-content
      |   display none
      | 
      | .tv-radio
      |   display none
      | 
      |   &:checked + .tv-content
      |     display block
      
  p The trick is in the details.
  ul
    li Clicking on the labels is effectively the same as clicking on the input boxes
    li The radio inputs are hidden with CSS
    li When a radio is selected, their curious tab content neighbors show up
    li="That's it! The only drawback is you won't be able to style the selected tab without resorting to some JS, but that shouldn't be a very big deal."

input.tv-radio#tv-tab-3(name='tv-group', type='radio')
div.tv-content
  h1 ?
  p  Hey there!
  ul
    li
      | I blog at 
      a(href='http://blog.ponyfoo.com') Pony Foo
    li
      | I tweet as 
      a(href='https://twitter.com/nzgb') @nzgb
    li
      | I push code to GitHub
      a(href='https://github.com/bevacqua') @bevacqua
  p
    em Later...

              
            
!

CSS

              
                .tv-content
  display none

.tv-radio
  display none

  &:checked + .tv-content
    display block

.tv-tab
  display inline-block
  cursor pointer
  padding 8px

  &:hover
    opacity 0.9












// these styles used just for this presentation,
// but not required by the tab widget
// colors from flatuicolors.com

c_asphalt = #34495e
c_midnight = #2c3e50
c_clouds = #ecf0f1
c_wisteria = #8e44ad
c_greensea = #16a085
c_pumpkin = #d35400
c_sunflower = #f1c40f

body
  margin 40px
  font-family 'Georgia'
  background-color #f3dc52


.tv-tabs
  color c_clouds

  :nth-child(odd)
    background-color c_midnight
  :nth-child(even)
    background-color c_asphalt

.tv-content
  padding 10px
  max-width 600px

#tv-tab-1 + .tv-content
  background-color c_wisteria
  color c_clouds

#tv-tab-2 + .tv-content
  background-color c_greensea
  color c_clouds

#tv-tab-3 + .tv-content
  background-color c_pumpkin
  color c_clouds

a, .tv-link
  display inline-block
  padding 2px
  color c_sunflower
  background-color rgba(#fff, 0.2)
  box-shadow 1px 1px 5px rgba(#fff, 0.2)
  transition all 0.4s ease-in-out

  &:hover
    background-color transparent
    box-shadow none

ul
  list-style-type binary

pre
  display block
  overflow hidden
  padding 8px
  background-color rgba(#000, 0.2)

code
  display block
  margin-top -10px
  margin-left -40px
              
            
!

JS

              
                
              
            
!
999px

Console