<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>@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("/wp-content/uploads/demos/_assets/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;
}</style>
</head>
<body>
<body>
<img src="http://localhost:10072/wp-content/uploads/demos/_assets/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>
<script>
</script>
</body>
</html>