欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于html css實(shí)現(xiàn)帶搜索圖標(biāo)的搜索框功能

  發(fā)布時(shí)間:2019-10-09 09:53:11   作者:佚名   我要評(píng)論
這篇文章主要介紹了基于html css實(shí)現(xiàn)帶搜索圖標(biāo)的搜索框功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

前言

給大家分享一下前端用處很多的帶小圖標(biāo)的搜索框的制作方法。

效果展示

在這里插入圖片描述
在這里插入圖片描述

基本思路

1、搜索圖像用絕對定位放到搜索框的上方

2、input框設(shè)置文本縮進(jìn),大小為搜索圖像大小加上圖像左右兩邊的外邊距

準(zhǔn)備

只需一個(gè)搜索圖標(biāo)圖片,類似于下圖

在這里插入圖片描述

代碼

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>搜索框demo</title>
 <style type="text/css">
  *{
   margin: 0;
   padding: 0;
  }
  body{
   width: 100vw;
   height: 100vh;
   background: radial-gradient(at center,
    #3498db,#2980b9);
   display: flex;
   justify-content: center;
   align-items: center;
  }
  div.search{
   height: 40px;
   width: 500px;  
  }
  div.search form{
   width: 100%;
   height: 100%;
  }
  div.search form input:nth-child(2){
   width: 400px;
   height: 100%;
   font-size: 16px;
   text-indent: 40px;
   border: none;
   float: left;
  }
  div.search form input:nth-child(3){
   width: 100px;
   height: 100%;
   font-size: 16px;
   letter-spacing: 5px;
   border: none;
  }
  div.search form img{
   position: absolute;
   left: 50vw;
   transform: translateX(-250px);
   margin-top: 10px;
   margin-left: 10px;
   height: 20px;
  }
 </style>
</head>
<body>
 <div class="search">
  <form action="#" method="post">
   <img src="./search_ico.png" alt="">
   <input type="text" name="condition" placeholder="請輸入搜索條件">
   <input type="submit" value="搜索">
  </form> 
 </div>
</body>
</html>

總結(jié)

以上所述是小編給大家介紹的基于html css實(shí)現(xiàn)帶搜索圖標(biāo)的搜索框功能,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

  • 分享8款純CSS3實(shí)現(xiàn)的搜索框功能

    本文通過實(shí)例代碼給大家分享8款純CSS3實(shí)現(xiàn)的搜索框功能,代碼簡單易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧
    2017-09-14
  • css3的動(dòng)畫特效之動(dòng)畫序列(animation)

    這篇文章主要介紹了css3的動(dòng)畫特效之動(dòng)畫序列(animation) 的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-12-22
  • CSS實(shí)現(xiàn)隱藏搜索框功能(動(dòng)畫正反向序列)

    純CSS實(shí)現(xiàn)動(dòng)畫效果:鼠標(biāo)移上圖標(biāo)顯示搜索框,鼠標(biāo)移出隱藏搜索框,這種效果給用戶帶來很好的體驗(yàn)效果,下面小編給大家?guī)砹薈SS實(shí)現(xiàn)隱藏搜索框功能(動(dòng)畫正反向序列)的完整
    2021-07-19

最新評(píng)論