感谢由LiuShen制作的插件和教程ヾ(^▽^*)))
前言
众所周知via浏览器是一款免费开源的非常好用的浏览器,其最大的特点就是体积小巧并且集成多种功能,安装完后仅仅3mb左右。
极简的软件设计有着高度的自定义功能,这篇文章是作者的via浏览器主页的分享。
这个主页的代码由作者结合其他大佬的作品并利用AI更改而成,感谢前人铺路。
效果预览
这个主页的搜索框出初始位置在下方,方便人手点击,聚焦后会上升至屏幕中央,同时Logo自动隐藏,无比丝滑。

Logo
Logo的样式是HTML代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <style> div p { text-align: center; background: linear-gradient(to right, #F596AA, #66CCFF 25%, #F596AA 50%, #66CCFF 75%, #F596AA); background-clip: text; -webkit-background-clip: text; color: transparent; background-size: 200% 100%; animation: runs 3s infinite linear; }
@keyframes runs { 0% { background-position: 0 0; } 100% { background-position: 100% 0; } } </style> </head> <body> <div> <p>Ciallo~(∠・ω< )⌒★</p> </div> <script> document.addEventListener("DOMContentLoaded", function () { var h, b = document.getElementById("search_submit"), c = document.createElement("select"), e = [], f = search, }; (c.style.color="#FFFFFF"), (c.style.float = "left"), (c.style.height = "46px"), (c.style.border = "none"), (c.style.paddingLeft = "10px"), (c.style.background = "transparent"), (c.style.outline = "none"), (c.style.borderRadius = "inherit"); for (h in g) e.push( "<option value=" + h + " " + (g[h].disabled || "") + ">" + g[h].name + "</option>" ); (c.innerHTML = e.join("")), (c.onchange = function () { var b, c; "c" !== this.value && "m" !== this.value ? ((b = !0), (localStorage.se = this.value)) : ((c = prompt( "请修改自定义地址\n注:via上取消也可能会清空(′⊙ω⊙`)", localStorage.c )), (c = (c || "").trim()), (b = !c), (this.value = b ? "i" : "c"), (localStorage.c = c)), (this.children[this.children.length - 1].disabled = b); }), (c.value = localStorage.se || "i"), b.parentElement.insertBefore(c, b), (search = function () { var a = document.getElementById("search_input"); return ( (a.value = a.value.trim()), a.value ? ((a.value = g[c.value].url + a.value), f()) : !1 ); }); }); </script> </body> </html>
|
自定义css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
| :root { --contenttop: 148vw; --searchbarmove: -68vw; --submitmove: 76vw; --searchbaradius: 15px; --searchbarwidth: 90vw; --searchbarclear: 0.1; --searchbarblur: 5px; --sugposition: 110vw; }
#content { position: fixed; top: var(--contenttop); transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.search_bar:focus-within ~ #content { transform: translateY(var(--searchbarmove)); }
#logo { position: relative; display: block; transform: translateY(0); opacity: 1; transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.search_bar:focus-within ~ #logo { transform: translateY(var(--searchbarmove)); opacity: 0; }
.opSug_wpr { width: var(--searchbarwidth) !important; border-radius: 15px !important; border: 0 !important; background: rgba(255, 255, 255, 0.2) !important; backdrop-filter: blur(5px); max-height: 250px !important; bottom: var(--sugposition); animation: enter-to 0.5s forwards; transform-origin: top center; }
@keyframes enter-to { from { transform: translateY(-40px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.search_bar { box-shadow: 0 0 5px rgba(70, 70, 40, 0.255); width: 80vw; background: rgba(255, 255, 255, var(--searchbarclear)); backdrop-filter: blur(5px); border-radius: var(--searchbaradius) !important; transform: translateY(0); position: relative; z-index: 10; transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.5s ease; }
.search_bar:focus-within { width: var(--searchbarwidth); transform: translateY(var(--searchbarmove)); transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s ease; }
#search_submit { position: absolute !important; z-index: 1; display: block !important; left: 80vw; opacity: 0; visibility: hidden; transition: left 0.9s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.6s ease-out, visibility 0.6s step-end; }
.search_bar:focus-within > #search_submit { left: var(--submitmove); opacity: 1; visibility: visible; animation: submit-appear 1s both; transition: none; }
@keyframes submit-appear { 0% { opacity: 0; transform: translateX(20px); } 50% { opacity: 0.5; transform: translateX(-5px); } 100% { opacity: 1; transform: translateX(0); } }
a, #bookmark_part { transform: translateY(0); opacity: 1; visibility: visible; transition: transform 0.4s, opacity 0.4s, visibility 0.4s; }
.search_part:focus-within ~ #bookmark_part { opacity: 0; visibility: hidden; transform: translateY(20px); }
.search_part:focus-within > a { opacity: 0; visibility: hidden; transform: translateY(20px); }
.opSug_wpr { } #search_submit { }
|
由于作者使用的是华为手机的小艺输入法输入框的位置会比默认的百度输入法低一点,请自行调整其中参数,注释已经非常详尽
背景壁纸
可自行 下载(选择) 图片后设置

注: 图片来源于网络