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 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

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

              
                <h2>scroll</h2>
<h3>scroll是預設值,代表背景圖樣的「相對位置」「不會」隨著滾動條而移動 (但是內容會移動)</h3>
<div class="scroll">
            <p>1</p>
            <p>2</p>
            <p>3</p>
            <p>4</p>
            <p>5</p>
            <p>6</p>
            <p>7</p>
            <p>8</p>
            <p>9</p>
            <p>10</p>
  <div class="expand"></div>              
            
</div>

<h2>fixed</h2>
<h3>fixed模式,代表背景圖樣的「絕對位置」「不會」隨著滾動條而移動 (但是內容仍會隨著移動)</h3>
<div class="fixed">           
            <p>1</p>
            <p>2</p>
            <p>3</p>
            <p>4</p>
            <p>5</p>
            <p>6</p>
            <p>7</p>
            <p>8</p>
            <p>9</p>
            <p>10</p>
<div class="expand"></div> </div>

<h2>local</h2>
<h3>在local模式下,元素與背景圖都會隨著滾動條而移動。</h3>
<div class="local">              
            <p>1</p>
            <p>2</p>
            <p>3</p>
            <p>4</p>
            <p>5</p>
            <p>6</p>
            <p>7</p>
            <p>8</p>
            <p>9</p>
            <p>10</p>
<div class="expand"></div></div>


              
            
!

CSS

              
                .scroll {
  background: url("https://www.tedu.tw/img/201806/1529376481842.jpg");
  background-attachment: scroll;
}

.fixed {
  background: url("https://www.tedu.tw/img/201806/1529376481842.jpg");
  background-attachment: fixed;
}

.local {
  background: url("https://www.tedu.tw/img/201806/1529376481842.jpg");
  background-attachment: local;
}

.expand {
  height: 200px;
  width: 100%;
}

.extra-space {
  margin-bottom: 50px;
}


/* styling for the Pen */

h2,h3 { font-family: Microsoft JhengHei;
  text-align: center;
  margin-top: 48px; }
p { color: #FFFFFF;
text-align: center;
text-style: bold;}
div {
  height: 200px;
  width: 100%;
  max-width: 600px;
  margin: 32px auto;
  overflow-x: hidden;
  overflow-y: scroll;
}

              
            
!

JS

              
                
              
            
!
999px

Console