将HTML样式转换为简单的搜索功能

问题描述 投票:-1回答:3

我正在创建一个简单的html页面作为Firefox默认主页。我使搜索功能正常工作,但是现在我想在页面中添加样式。

这是我的职责:

    <form action="" onsubmit="return false">
  <input name="term_1" size="38" maxlength="50" value="" id="searchbox" placeholder="Enter search term.."><br />
  <select name="field_1" id="option">
    <option value="t" selected="selected">Title</option>
    <option value="a">Author</option>
    <option value="s">Subject</option>
    <option value="call_number">Call Number</option>
    <option value="p">Publisher</option>
  </select>

  <input value="Submit"  type="button" onclick=search()>
  <input value="Reset" type="reset">
</form>

<script>
function search()
{
   var search_input=document.getElementById("searchbox").value;// value of search box
   var option=document.getElementById("option").value; //value of select

   window.open('http://webpac.kdu.edu.my/search/query?match_1=MUST&field_1=' + option + '&term_1=' + search_input + '&facet_loc=20000&sort=relevance&theme=kdu', 'bswindow');   //proceed with search
}
</script>

我想要样式这样的东西

https://www.w3schools.com/code/tryit.asp?filename=GAQ6A12ICCQF

html styles
3个回答
0
投票

请参阅W3schools CSS页面以获取更多样式https://www.w3schools.com/howto/howto_css_searchbar.asp


0
投票

为了设置样式,必须应用CSS。


0
投票
<div id="cover">
  <form method="get" action="">
    <div class="tb">
      <div class="td"><input type="text" placeholder="Search" required></div>
      <div class="td" id="s-cover">
        <button type="submit">
          <div id="s-circle"></div>
          <span></span>
        </button>
      </div>
    </div>
  </form>
</div>


*
{
    outline: none;
}
html, body
{
    height: 100%;
    min-height: 100%;
}
body
{
    margin: 0;
    background-color: #ffd8d8;
}
.tb
{
    display: table;
    width: 100%;
}
.td
{
    display: table-cell;
    vertical-align: middle;
}
input, button
{
    color: #fff;
    font-family: Nunito;
    padding: 0;
    margin: 0;
    border: 0;
    background-color: transparent;
}
#cover
{
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    width: 550px;
    padding: 35px;
    margin: -83px auto 0 auto;
    background-color: #ff7575;
    border-radius: 20px;
    box-shadow: 0 10px 40px #ff7c7c, 0 0 0 20px #ffffffeb;
    transform: scale(0.6);
}
form
{
    height: 96px;
}
input[type="text"]
{
    width: 100%;
    height: 96px;
    font-size: 60px;
    line-height: 1;
}
input[type="text"]::placeholder
{
    color: #e16868;
}
#s-cover
{
    width: 1px;
    padding-left: 35px;
}
button
{
    position: relative;
    display: block;
    width: 84px;
    height: 96px;
    cursor: pointer;
}
#s-circle
{
    position: relative;
    top: -8px;
    left: 0;
    width: 43px;
    height: 43px;
    margin-top: 0;
    border-width: 15px;
    border: 15px solid #fff;
    background-color: transparent;
    border-radius: 50%;
    transition: 0.5s ease all;
}
button span
{
    position: absolute;
    top: 68px;
    left: 43px;
    display: block;
    width: 45px;
    height: 15px;
    background-color: transparent;
    border-radius: 10px;
    transform: rotateZ(52deg);
    transition: 0.5s ease all;
}
button span:before, button span:after
{
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 45px;
    height: 15px;
    background-color: #fff;
    border-radius: 10px;
    transform: rotateZ(0);
    transition: 0.5s ease all;
}
#s-cover:hover #s-circle
{
    top: -1px;
    width: 67px;
    height: 15px;
    border-width: 0;
    background-color: #fff;
    border-radius: 20px;
}
#s-cover:hover span
{
    top: 50%;
    left: 56px;
    width: 25px;
    margin-top: -9px;
    transform: rotateZ(0);
}
#s-cover:hover button span:before
{
    bottom: 11px;
    transform: rotateZ(52deg);
}
#s-cover:hover button span:after
{
    bottom: -11px;
    transform: rotateZ(-52deg);
}
#s-cover:hover button span:before, #s-cover:hover button span:after
{
    right: -6px;
    width: 40px;
    background-color: #fff;
}

搜索栏的演示。您可以按照此操作。

© www.soinside.com 2019 - 2024. All rights reserved.