
HTML・CSSで作るおしゃれな検索フォームのデザイン9選
サイト内検索において必要不可欠な検索ボックスのデザインスニペットをまとめました。どれもコピペ可能ですので、ご自身のサイトに適したデザインのフォームをお好きな色にカスタマイズして、ぜひ取り入れてみてください。
フラットな検索フォーム
四角
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-005">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-005 {
display: flex;
align-items: center;
overflow: hidden;
border-radius: 3px;
}
.search-form-005 input {
width: 250px;
height: 45px;
padding: 5px 15px;
border: none;
border-radius: 3px 0 0 3px;
box-sizing: border-box;
background-color: #e6edf3;
font-size: 1em;
outline: none;
}
.search-form-005 input::placeholder {
color: #767d83;
}
.search-form-005 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
border-radius: 0 3px 3px 0;
background-color: #2589d0;
cursor: pointer;
}
.search-form-005 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
角丸
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-006">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-006 {
display: flex;
align-items: center;
border-radius: 25px;
overflow: hidden;
}
.search-form-006 input {
width: 250px;
height: 45px;
padding: 5px 15px;
border: none;
box-sizing: border-box;
background-color: #e6edf3;
font-size: 1em;
outline: none;
}
.search-form-006 input::placeholder {
color: #767d83;
}
.search-form-006 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
background-color: #2589d0;
cursor: pointer;
}
.search-form-006 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
単色の検索フォーム
四角
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-001">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-001 {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
border: 2px solid #2589d0;
border-radius: 3px;
}
.search-form-001 input {
width: 250px;
height: 45px;
padding: 5px 15px;
border: none;
box-sizing: border-box;
font-size: 1em;
outline: none;
}
.search-form-001 input::placeholder{
color: #767d83;
}
.search-form-001 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
background-color: #2589d0;
cursor: pointer;
}
.search-form-001 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
角丸
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-002">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-002 {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
border: 2px solid #2589d0;
border-radius: 25px;
}
.search-form-002 input {
width: 250px;
height: 45px;
padding: 5px 15px;
border: none;
box-sizing: border-box;
font-size: 1em;
outline: none;
}
.search-form-002 input::placeholder{
color: #767d83;
}
.search-form-002 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
background-color: #2589d0;
cursor: pointer;
}
.search-form-002 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
シンプルな検索フォーム
枠線
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-003">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-003 {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
border: 1px solid #767d83;
border-radius: 3px;
}
.search-form-003 input {
width: 250px;
height: 45px;
padding: 5px 15px;
border: none;
box-sizing: border-box;
font-size: 1em;
outline: none;
}
.search-form-003 input::placeholder{
color: #767d83;
}
.search-form-003 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
background-color: transparent;
cursor: pointer;
}
.search-form-003 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23767d83%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
枠線×アイコン左
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-011">
<button type="submit" aria-label="検索"></button>
<label>
<input type="text" placeholder="キーワードを入力">
</label>
</form>
step3
CSSをコピペする
CSS
.search-form-011 {
display: flex;
align-items: center;
overflow: hidden;
border: 1px solid #767d83;
border-radius: 3px;
}
.search-form-011 input {
width: 250px;
height: 45px;
padding: 5px 15px 5px 0;
border: none;
box-sizing: border-box;
font-size: 1em;
outline: none;
}
.search-form-011 input::placeholder {
color: #767d83;
}
.search-form-011 button {
display: flex;
justify-content: center;
align-items: center;
width: 45px;
height: 45px;
border: none;
background-color: transparent;
cursor: pointer;
}
.search-form-011 button::before {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23767d83%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
背景色あり
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-012">
<label>
<input type="text" placeholder="キーワードを入力">
</label>
<button type="submit" aria-label="検索"></button>
</form>
step3
CSSをコピペする
CSS
.search-form-012 {
display: flex;
justify-content: space-between;
align-items: center;
width: 250px; /* 任意の幅に調整してください */
overflow: hidden;
border-radius: 3px;
background-color: #e6edf3;
}
.search-form-012 input {
height: 45px;
padding: 5px 15px;
border: none;
box-sizing: border-box;
background-color: #e6edf3;
font-size: 1em;
outline: none;
}
.search-form-012 input::placeholder {
color: #767d83;
}
.search-form-012 button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 45px;
border: none;
background-color: transparent;
cursor: pointer;
}
.search-form-012 button::after {
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23767d83%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}
その他の検索フォーム
Googleのトップページ風
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-009">
<label>
<input type="text" aria-label="キーワードを入力">
</label>
</form>
step3
CSSをコピペする
CSS
.search-form-009 {
display: flex;
align-items: center;
overflow: hidden;
border: 1px solid #dfe1e5;
border-radius: 24px;
}
.search-form-009:hover {
box-shadow: 0 1px 6px rgb(32 33 36 / 28%);
}
.search-form-009::before {
width: 45px;
height: 15px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%239aa0a6%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-position: center;
background-repeat: no-repeat;
content: '';
}
.search-form-009 input {
width: 250px;
height: 40px;
padding: 5px 25px 5px 0;
border: none;
box-sizing: border-box;
outline: none;
}
Yahooのトップページ風
step1
デザインを調整する
step2
HTMLをコピペする
HTML
<form action="#" class="search-form-010">
<label>
<input type="text" aria-label="キーワードを入力">
</label>
<button type="submit">検索</button>
</form>
step3
CSSをコピペする
CSS
.search-form-010 {
display: flex;
align-items: center;
gap: 0 10px;
}
.search-form-010 label {
width: 250px;
}
.search-form-010 input {
width: 100%;
height: 34px;
padding: 1px 5px 1px 8px;
border: 1px solid #999999;
box-sizing: border-box;
color: #000;
outline: none;
}
.search-form-010 button {
display: flex;
justify-content: center;
align-items: center;
width: 30%;
max-width: 140px;
height: 34px;
border: none;
background-color: #4070ff;
color: #fff;
cursor: pointer;
}
.search-form-010 button::before {
width: 14px;
height: 14px;
margin-right: 5px;
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M23.7%2020.8%2019%2016.1c-.2-.2-.5-.3-.8-.3h-.8c1.3-1.7%202-3.7%202-6C19.5%204.4%2015.1%200%209.7%200S0%204.4%200%209.7s4.4%209.7%209.7%209.7c2.3%200%204.3-.8%206-2v.8c0%20.3.1.6.3.8l4.7%204.7c.4.4%201.2.4%201.6%200l1.3-1.3c.5-.5.5-1.2.1-1.6zm-14-5.1c-3.3%200-6-2.7-6-6s2.7-6%206-6%206%202.7%206%206-2.6%206-6%206z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%20%3C%2Fsvg%3E');
background-repeat: no-repeat;
content: '';
}