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

              
                <h4>Властивість <code>background-attachment</code></h4>

<p>У цьому прикладі Ви бачите два блоки з фоновим зображенням. Для лівого блоку застосоване значення <strong>local</strong> для <code>background-attachment</code>, а для правого - <strong>fixed</strong>.</p>

<p>Тобто фон у лівому блоці прокручується тільки всередині цього блоку, але не разом з усією сторінкою, а у другому блоці фон взагалі не прокручується.</p>

<div class="demo">
	<div class="block local">
	  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa 
    <strong>strong</strong>. Cum sociis natoque penatibus 
    et magnis dis parturient montes, nascetur ridiculus 
    mus. Donec quam felis, ultricies nec, pellentesque 
    eu, pretium quis, sem. Nulla consequat massa quis 
    enim. Donec pede justo, fringilla vel, aliquet nec, 
    vulputate eget, arcu. In enim justo, rhoncus ut, 
    imperdiet a, venenatis vitae, justo. Nullam dictum 
    felis eu pede <a class="external ext" href="#">link</a> 
    mollis pretium. Integer tincidunt. Cras dapibus. 
    Vivamus elementum semper nisi. Aenean vulputate 
    eleifend tellus. Aenean leo ligula, porttitor eu, 
    consequat vitae, eleifend ac, enim. Aliquam lorem ante, 
    dapibus in, viverra quis, feugiat a, tellus. Phasellus 
    viverra nulla ut metus varius laoreet. Quisque rutrum. 
    Aenean imperdiet. Etiam ultricies nisi vel augue. 
    Curabitur ullamcorper ultricies nisi.</p>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa. 
    Cum sociis natoque penatibus et magnis dis parturient 
    montes, nascetur ridiculus mus. Donec quam felis, 
    ultricies nec, pellentesque eu, pretium quis, sem.</p>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa. 
    Cum sociis natoque penatibus et magnis dis parturient 
    montes, nascetur ridiculus mus. Donec quam felis, 
    ultricies nec, pellentesque eu, pretium quis, sem.</p>
	</div>
	<div class="block fixed">
	  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa 
    <strong>strong</strong>. Cum sociis natoque penatibus 
    et magnis dis parturient montes, nascetur ridiculus 
    mus. Donec quam felis, ultricies nec, pellentesque 
    eu, pretium quis, sem. Nulla consequat massa quis 
    enim. Donec pede justo, fringilla vel, aliquet nec, 
    vulputate eget, arcu. In enim justo, rhoncus ut, 
    imperdiet a, venenatis vitae, justo. Nullam dictum 
    felis eu pede <a class="external ext" href="#">link</a> 
    mollis pretium. Integer tincidunt. Cras dapibus. 
    Vivamus elementum semper nisi. Aenean vulputate 
    eleifend tellus. Aenean leo ligula, porttitor eu, 
    consequat vitae, eleifend ac, enim. Aliquam lorem ante, 
    dapibus in, viverra quis, feugiat a, tellus. Phasellus 
    viverra nulla ut metus varius laoreet. Quisque rutrum. 
    Aenean imperdiet. Etiam ultricies nisi vel augue. 
    Curabitur ullamcorper ultricies nisi.</p>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa. 
    Cum sociis natoque penatibus et magnis dis parturient 
    montes, nascetur ridiculus mus. Donec quam felis, 
    ultricies nec, pellentesque eu, pretium quis, sem.</p>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing 
    elit. Aenean commodo ligula eget dolor. Aenean massa. 
    Cum sociis natoque penatibus et magnis dis parturient 
    montes, nascetur ridiculus mus. Donec quam felis, 
    ultricies nec, pellentesque eu, pretium quis, sem.</p>
	</div>
</div>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}
	
body {
	font-family: sans-serif;
	line-height: 1.45;
	font-size: 18px;
	padding: 16px 16px 0 16px;
}

h4 {
	color: #4f4f4f;
	font-weight: 400;
  text-align: center;
}

.demo {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.block {
	width: 45%;
  padding: 8px;
	height: 350px;
	border: 8px solid #4f4f4f;
	font-family: monospace;
	line-height: 1.45;
	font-size: .8em;
	color: #000;
  overflow-y: scroll;
  background: url(https://lorempixel.com/150/150/);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

.local { background-attachment: local; }
.fixed { background-attachment: fixed; }
              
            
!

JS

              
                
              
            
!
999px

Console