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

              
                <head>
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <!--==============レイアウトを制御する独自のCSSを読み込み===============-->
  <link rel="stylesheet" type="text/css" href="https://assets.codepen.io/6329135/reset.css">
</head>

<body>
  <img src="https://assets.codepen.io/6329135/wave.jpeg" />

  <div id="search-wrap">
    <form role="search" method="get" action="">
      <input type="text" value="" name="" id="search-text">
    </form>
  </div>

  <p class="text">虫眼鏡マークをクリックすると<br>検索窓が伸びて出現する検索</p>
</body>
              
            
!

CSS

              
                @charset "utf-8";

/*========= 検索窓のためのCSS ===============*/

/*検索窓のエリア*/
#search-wrap {
  position: absolute; /*絶対配置にして*/
  z-index: 2; /*最前面に設定。数字は変更可*/
  top: 10px;
  right: 10px;
}

/*テキスト入力input設定*/
#search-text {
  -webkit-appearance: none; /*SafariやChromeのデフォルトの設定を無効*/
  width: 60px; /*テキスト入力エリアが伸びる前の横幅*/
  height: 60px;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 5px 5px 2px rgba(6, 0, 1, 0.7);
  background: rgba(255, 255, 255, 0.3)
    url("https://assets.codepen.io/6329135/icon_search.svg") no-repeat 17px
    center; /*虫眼鏡アイコンを背景に表示*/
  background-size: 20px 20px;
  transition: all 0.5s; /*transitionを使ってスムースに伸ばす*/
  outline: none;
  cursor: pointer; /*カーソルを指マークに*/
}

/*テキスト入力inputにフォーカスした時の形状*/
#search-text:focus {
  width: 40vw; /*テキスト入力エリアが伸びる後の横幅*/
  padding: 20px 0 20px 60px;
  background-color: rgba(255, 255, 255, 0.6);
}

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

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

              
            
!

JS

              
                
              
            
!
999px

Console