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

              
                <input type="checkbox" id="slide">

<div class= "float-banner">
  <!---- ここにバナー ---->
  <div>
    <a href="https://give-shot.jp/tokyocss/">
      <img src="https://give-shot.jp/tokyocss/wp-content/uploads/2022/04/tokyocss-banner.png" width="720px" height="80px">
      </a>
  </div>
  <!---- ここまでバナー ---->
  <label for="slide" class="slide-btn"></label>
</div>
              
            
!

CSS

              
                /******************************
 登場時のアニメーション
******************************/
@keyframes slide-in{
  0%{
    bottom: -600px; /*画面外*/
    visibility: hidden;
  }
  100%{
    bottom: 0; /*画面下部*/
    visibility: visible;
  }
}

/******************************
 追従バナー
******************************/
.float-banner{
  display: inline-block; /*中身の高さで変動*/
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%; /*画面幅*/
  background: #fafafa;
  text-align: center;
  animation: slide-in 3s ease forwards;/*登場*/
  animation-delay: 0s; /*登場の遅延時間*/
  transition: 1s ease-in-out; /*スライド時の動き*/
}

/* バナー下の枠線 */
.float-banner:after{
  content: "";
  position: absolute;
  bottom: 100%;
  left: 70px; /*ボタン分の幅を左に確保*/
  width: calc(100% - 70px);
  height: 5px;
  background: #fafafa;
  box-shadow: 0px -2px 4px -1px rgba(0,0,0,20%), 0px 1px 2px -1px rgba(0,0,0,15%);
}

/* スライドボタンをクリック */
#slide:checked ~ .float-banner{
  transform: translateY(100%); /*画面外(下)へ*/
}

/**************************************
 表示・非表示を切り替えるスライドボタン
***************************************/
.slide-btn{
  position: absolute;
  bottom: calc(100% + 5px); /*枠線分を空ける*/
  left: 0;
  width: 70px;
  height: 25px;
  border-radius: 0 6px 0 0; /*右上だけ丸く*/
  background: #fafafa;
  box-shadow: 1px -2px 3px rgba(0,0,0,25%);
}

/* スライドボタンの文字 */
.slide-btn:before{
  content: "^";
  position: absolute;
  top: 35%; /*下寄りの文字なので少し調整*/
  left: 50%;
  transform: translate(-50%,-50%) rotate(180deg);
  font-size: 16px;
  font-weight: bold; /*太字*/
  color: #666;
}

/* スライドボタン上の枠線部分 */
.slide-btn:after{
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 70px;
  height: 5px;
  background: #fafafa;
  box-shadow: 0px 1px 2px -1px rgba(0,0,0,15%);;
}

/* クリックで矢印を反転 */
#slide:checked ~ .float-banner .slide-btn:before{
  top: 65%; /*上寄りの文字なので少し調整*/
  transform: translate(-50%,-50%);
}


/**** チェックボックス ****/
#slide{
  display: none; /*非表示*/
}

/**** 自作バナー用 ****/
.float-banner img{
  vertical-align: bottom; /*画像下の余白削除*/
}

/**** スマホ対策 ****/
@media only screen and (max-width: 599.9px) {
  .float-banner img{
    max-width: 360px;
    height: auto;
  }
}

/**** タブレット対策 ****/
@media only screen and (min-width: 600px) and (max-width: 959px) {
  .float-banner img{
    max-width: 800px;
    height: auto;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console