css+js实现三种搜索框点击展开效果代码
代码语言:html
所属分类:搜索
代码描述:css+js实现三种搜索框点击展开效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.3.0.css"> <style> * { margin: 0; box-sizing: border-box; } body { font-family: verdana, sans-serif; background-color: rgb(240, 240, 240); } .search-box-1 { position: relative; margin: 100px; border-radius: 10px; height: 60px; overflow: hidden; width: 300px; border-radius: 50%; } .search-box-1 .s-input { background-color: #fff; padding: 10px 20px; width: 0%; height: 100%; border: none; transition: all 1s; } .search-box-1.active .s-input:focus { width: 100%; } .search-box-1 .s-icon { position: absolute; left: 0; top: 0; width: 60px; height: 60px; border-radius: 10px; border: none; background-color: rgb(255, 255, 255); color: #333; border-radius: 50%; font-size: 20px; display: flex; justify-content: center; align-items: center; transition: all 1s; cursor: pointer; } .search-box-1.active .s-input:focus + .s-icon { left: calc(100% - 60px); background-color: rgb(101, 180, 245); color: #fff; } .search-box-1 .s-icon:focus, .search-box-1 .s-input:focus { outline: none; } /* Search 2 */ .search-box-2 { position: relative; margin: 100px; height: 60px; overflow: hidden; width: 300px; } .search-box-2 .s-input { background-color: #fff; padding: 0px; border-radius: 40px 0 0 40px; width: 0%; height: 100%; border: none; transition: all 1s; } .search-box-2.active .s-input:focus { width: 90%; padding: 10px 20px; } .search-box-2 .s-icon { position: absolute; left: 0; top: 0; width: 60px; height: 60px; border: none; background-color: rgb(101, 180, 245); border-radius: 50%; color: #fff; font-size: 24px; display: flex; justify-content: center; align-items: center; transition: all 1s; cursor: pointer; } .search-box-2.active .s-input:focus + .s-icon { left: calc(100% - 60px); background-color: rgb(255, 255, 255); color: #333; } .search-box-2 .s-icon:focus, .search-box-2 .s-input:focus { outline: none; } /* Search 3 */ .search-box-3 { position: relative; margin: 100px; height: 60px; overflow: hidden; width: 300px; } .search-box-3 .s-input { background-color: #fff; padding: 0px; border-radius: 40px 0 0 40px; width: 0%; height: 100%; border: none; transition: all 1s; } .search-box-3.active .s-input:focus { width: 90%; padding: 10px 20px; } .search-box-3 .s-icon { position: absolute; left: 0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0