20
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【HTML】CSSによる検索フォームのデザイン

Last updated at Posted at 2017-10-03

デフォルトのデザイン

form00.PNG

HTML
<form action="#">
    <input type="text">
    <input type="submit">
</form>

一体型

form01.PNG

HTML
<form id="form01" action="#">
    <input id="input01" type="text"><!--
    /input間で改行したい場合はコメントアウト必須/
    --><input id="submit01" type="submit" value="検索">
</form>
CSS
#form01{
    background-color: white;
    width:200px;
    height: 20px;
    border: 1px green solid;
}
#form01 input{
    vertical-align: top;
    margin: 0px;
    height: 100%;
    box-sizing: border-box;
    background-color: transparent;
}
#input01{
    width: 150px;
    border: none;
    border-right: 1px green solid;
}
#submit01{
    width: 50px;
    border: none;
}

一体型(画像ボタンによるsubmit)

form03.PNG

HTML
<form id="form02" action="#">
    <input id="input02" type="text" placeholder="検索"><!--
    /input間で改行したい場合はコメントアウト必須/
    --><input id="submit02" type="submit" value="">
</form>
CSS
#form02{
    background-color: white;
    width:200px;
    height: 20px;
    border: 1px green solid;
}
#form02 input{
    vertical-align: top;
    margin: 0px;
    height: 100%;
    box-sizing: border-box;
    background-color: transparent;
}
#form02{
    border-radius: 10px;
}
#input02{
    border: none;
    width: 170px;
    padding-left: 10px;
}
#submit02{
    width: 30px;
    border: none;
    background-image: url(画像へのパス);
    background-position: center;
    background-size: auto 90%;
    background-repeat: no-repeat;
}
20
33
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?