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

              
                <div class="container">
<img src="https://1-notes.com/images/slime-button.svg" alt="" width="" height="" border="0" />
  <div class="stars">
    <span class="s"></span>
    <span class="s"></span>
    <span class="s"></span>
    <span class="s"></span>
    <span class="s"></span>
    <span class="m"></span>
    <span class="m"></span>
    <span class="m"></span>
    <span class="m"></span>
    <span class="m"></span>
    <span class="l"></span>
    <span class="l"></span>
    <span class="l"></span>
    <span class="l"></span>
    <span class="l"></span>
  </div>
</div>

<div>
<p><a href="https://1-notes.com/css-pixel-stars-animation/" target="_blank" rel="noopener">https://1-notes.com/css-pixel-stars-animation/</a></p>
</div>
              
            
!

CSS

              
                .container{
  position:relative;
  width: 250px;
  height:250px;
  background:#191970;
}

.container img{
  width: 100%;
  height:100%;
}

.stars{
  position: absolute;
  left:0;
  top:0;
  width: 100%;
  height:100%;
}

.stars span{
  position:relative;
}

.stars span:before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  
  /*星のサイズ調節*/
  transform:scale(0.20);
}

.stars span.s:before{
  
   /*20px 20pxが中央*/
  box-shadow: 20px 20px #FFFFFF;
}

.stars span.m:before{
  box-shadow: 
    /*1段目*/
    20px 10px #FFF176,
    /*2段目*/
    10px 20px #FFF176,
    20px 20px #FFFFFF,
    30px 20px #FFF176,
    /*3段目*/
    20px 30px #FFF176
}

.stars span.l:before{
  box-shadow: 
    /*0段目*/
    20px  0px #FDD835,
    /*1段目*/
    20px 10px #FFF176,
    /*2段目*/
     0px 20px #FDD835,
    10px 20px #FFF176,
    20px 20px #FFFFFF,
    30px 20px #FFF176,
    40px 20px #FDD835,
    /*3段目*/
    20px 30px #FFF176,
    /*4段目*/
    20px 40px #FDD835;
}


 /*
星の位置とアニメーション指定
最初の秒はアニメーション時間、2つ目は開始までの時間
*/
.stars span:nth-child(1){left:10%; top:10%; animation: star-anim 8s 0s infinite;}
.stars span:nth-child(2){left:80%; top:20%; animation: star-anim 6s 1s infinite;}
.stars span:nth-child(3){left:60%; top:40%; animation: star-anim 5s 2s infinite;}
.stars span:nth-child(4){left:20%; top:70%; animation: star-anim 7s 3s infinite;}
.stars span:nth-child(5){left:80%; top:80%; animation: star-anim 7s 4s infinite;}

.stars span:nth-child(6){left:40%; top:10%; animation: star-anim 4s 0s infinite;}
.stars span:nth-child(7){left:10%; top:50%; animation: star-anim 7s 1s infinite;}
.stars span:nth-child(8){left:50%; top:50%; animation: star-anim 8s 2s infinite;}
.stars span:nth-child(9){left:90%; top:90%; animation: star-anim 5s 3s infinite;}
.stars span:nth-child(10){left:80%; top:50%; animation: star-anim 7s 4s infinite;}

.stars span:nth-child(11){left:90%; top:10%; animation: star-anim 5s 0s infinite;}
.stars span:nth-child(12){left:10%; top:80%; animation: star-anim 6s 1s infinite;}
.stars span:nth-child(13){left:30%; top:20%; animation: star-anim 7s 2s infinite;}
.stars span:nth-child(14){left:60%; top:90%; animation: star-anim 8s 3s infinite;}
.stars span:nth-child(15){left:80%; top:50%; animation: star-anim 7s 4s infinite;}


@keyframes star-anim {
  0% {opacity:0;}
  5% {opacity:1;}
  10% {opacity:0;}
  55% {opacity:0;}
  60% {opacity:1;}
  95% {opacity:0;}
  100% {opacity:1;}
}
              
            
!

JS

              
                


 




              
            
!
999px

Console