css製作好看的搜尋方塊

來源:互聯網
上載者:User
做網站開發我們肯定少不了一種最基本的功能,就是搜尋方塊,那麼搜尋方塊樣式也能讓一個網站看起來更加美觀上檔次。現在我們就教大家一種如何把搜尋方塊做的很美觀的方法。


實現這種效果有兩種方法:一是整體處理一個背景,以透明gif圖的方式定位到搜尋方塊,或者切分開,這種方法載入快,而且靈活性更高。
文中用到的圖片


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>CSS美化的漂亮搜尋方塊</title>  <style type="text/css">  body{  font: normal 100% 'Arial','Helvetica','Verdana',sans-serif;  color: #333;  }  p {  padding: 12px 0;  margin: 0;  font-size: .8em;  line-height: 1.5;  }  form {  margin: 0;  }  #search_box {  width: 201px;  height: 31px;  background: url(http://files.jb51.net/demoimg/200912/bg_search_box.gif);  }  #search_box #s {  float: left;  padding: 0;  margin: 6px 0 0 6px;  border: 0;  width: 159px;  background: none;  font-size: .8em;  }  #search_box #go {  float: right;  margin: 3px 4px 0 0;  }  </style>  </head>  <body>  <div id="search_box">  <form id="search_form" method="post" action="#">  <input type="text" id="s" value="Search" />   <input type="image" src="http://files.jb51.net/demoimg/200912/btn_search_box.gif" width="27" height="24" id="go" alt="Search" title="Search" />    </form>     </div>      </body>       </html>

提示:您可以先修改部分代碼再運行

以上就是我們用css實現的搜尋方塊,簡單美觀,當然大家可以按照以上的方法去製作一個自己喜歡的搜尋方塊。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.