Pen Settings



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


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


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.


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.


  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="">

  <img src="" />

  <div class="open-btn"></div>
  <p class="text">虫眼鏡マークをクリックすると<br>下からふわっと検索窓が出現</p>
  <div id="search-wrap">

    <form role="search" method="get" id="searchform" action="">
      <input type="text" value="" name="" id="search-text" placeholder="search">
      <input type="submit" id="searchsubmit" value="">


  <script src="" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>


                @charset "utf-8";

/*========= 検索窓を開くためのボタン設定 ===========*/

.open-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: url("") no-repeat
    15px center; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 50px;
  height: 50px;
  cursor: pointer; /*カーソルを指マークに*/

/*クリック後、JSでボタンに btnactive クラスが付与された後の見た目*/
.open-btn.btnactive {
  background: url("") no-repeat
    15px center; /*閉じるアイコンを背景に表示*/
  background-size: 18px 18px;

/*========= 検索窓の設定 ===============*/


#search-wrap {
  position: absolute; /*絶対配置にして*/
  top: 150px;
  right: 20px;
  z-index: -1; /*最背面に設定*/
  opacity: 0; /*透過を0に*/
  width: 0; /*横幅は0に*/
  transition: all 0.4s; /*transitionを使ってスムースに現れる*/
  border-radius: 5px;

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後の見た目*/
#search-wrap.panelactive {
  opacity: 1; /*不透明に変更*/
  z-index: 3; /*全面に出現*/
  width: 280px;
  padding: 20px;
  top: 60px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);

#search-wrap #searchform {
  display: none; /*検索窓は、はじめ非表示*/

/*ボタンクリック後、JSで#search-wrapに panelactive クラスが付与された後*/
#search-wrap.panelactive #searchform {
  display: block; /*検索窓を表示*/


#search-wrap input {
  -webkit-appearance: none; /*SafariやChromeのデフォルトの設定を無効*/
  outline: none;
  cursor: pointer; /*カーソルを指マークに*/
  color: #666;

#search-wrap input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 2px solid #ccc;
  transition: all 0.5s;
  letter-spacing: 0.05em;
  height: 46px;
  padding: 10px;

#search-wrap input[type="text"]:focus {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5); /*背景色を付ける*/

#search-wrap input[type="submit"] {
  position: absolute;
  top: 10px;
  right: 30px;
  background: url("") no-repeat
    right; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  width: 30px;
  height: 60px;

/*========= レイアウトのためのCSS ===============*/
img {
  width: 100%;
  height: 100vh;
  vertical-align: middle;
  filter: brightness(95%) blur(1px);
  object-fit: cover;

.text {
  margin: 0 0 10px 0;
  position: absolute;
  mix-blend-mode: overlay;
  color: white;
  font-size: clamp(12px, 3vw, 2rem);
  font-weight: bold;
  text-align: left;
  top: 20px;
  left: 20px;



$(".open-btn").click(function () {
  $(this).toggleClass("btnactive"); //.open-btnは、クリックごとにbtnactiveクラスを付与&除去。1回目のクリック時は付与
  $("#search-wrap").toggleClass("panelactive"); //#search-wrapへpanelactiveクラスを付与
  $("#search-text").focus(); //テキスト入力のinputにフォーカス