Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!-- 
Fun and useless fact of the day – Marquee tags can scroll in both directions by nesting them.

Therefore I did the only sensible thing I could think of for this usecase and themed a couple of marquee tags to look like Pong.
-->

<h1>Marquee Pong!</h1>

<!-- To change the speed simply change the scrollamount for both directions! -->
<div class="marquee-wrapper">
  <span class="score score-pl1">4</span>
  <span class="score score-pl2">2</span>
  <marquee direction="down" width="800px" height="600px" behavior="alternate" scrollamount="20" class="marquee-outer">
    <marquee behavior="alternate" scrollamount="20" class="marquee-inner">
      <img src="https://ashleynolan.co.uk/assets/img/blog/santa.png" />
    </marquee>
  </marquee>
</div>
              
            
!

CSS

              
                $mq-margin: 80px;
$pong-border-color: white;
$pong-bg-color: black;

// Define the fonts used in the Pen
@import url(https://fonts.googleapis.com/css?family=Press+Start+2P);

body {
  background-color: #f1f1f1;
  font-family: 'Press Start 2P', cursive;
}

h1 {
  text-transform: uppercase;
  text-align: center;
}

.marquee-wrapper {
  position: relative;
  margin-top: $mq-margin;
}
.marquee-outer {
  position: relative;
  display: block;
  border: solid;
  margin: 0 auto;
  background: $pong-bg-color;
  
  & img {
    width: 60px;
  }
  &:after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    border-left: 1px dashed $pong-border-color;
  }
}
.marquee-inner {
  border-left: 6px solid $pong-border-color;
  border-right: 6px solid $pong-border-color;
  margin: 0 5px;
}

.score {
  position: absolute;
  top: -($mq-margin - 40);
  font-size: 30px;
  z-index: 2;
}
.score-pl1 {
  left: 40%;
}
.score-pl2 {
  right: 40%;
}
              
            
!

JS

              
                
              
            
!
999px

Console