网站移动端下方固定导航按钮的方法

66次阅读
没有评论

共计 2051 个字符,预计需要花费 6 分钟才能阅读完成。

现在互联网上的流量早已是移动端的天下,所以不少网站也在不断增强移动端的体验。移动端的网页同 PC 端相比屏幕小,展现的内容也相对较少,所以通常会多加一些按钮来引导读者朋友们。橘子君在网络上看到一种固定导航按钮的方法很不错,使用非常简单,特此记录分享一下。

实现该功能的代码

<style type="text/css">.nav{display:none;}@media only screen and (max-width:450px){.site-info{padding:15px 0 52px 0;}#advert_widget,.php_text .widget-text,.widget .textwidget{padding:0;}.nav{position:fixed;z-index:999;bottom:0;width:100%;height:52px;display:block;right:0;box-shadow:0px 0px 10px 3px rgba(223,233,247,1.0);-webkit-box-shadow:0px 0px 10px 3px rgba(223,233,247,1.0);-moz-box-shadow:0px 0px 10px 3px rgba(223,233,247,1.0);-o-box-shadow:0px 0px 10px 3px rgba(223,233,247,1.0);-ms-box-shadow:0px 0px 10px 3px rgba(223,233,247,1.0);}.nav{padding-left:0;margin-bottom:0;list-style:none;}.nav img{width:50px !important;height:50px !important;}.nav > ul{position:relative;z-index:1;height:52px;background:rgba(255,255,255,.85);list-style-image:none;list-style-type:none;margin:0px;padding:0px !important;}.nav ul li{position:relative;float:left;width:20%;text-align:center;margin:0px;padding:0px;list-style-image:none;list-style-type:none;top:0px;left:3%;}.nav ul li a{display:block;margin-right:auto;margin-left:auto;}}</style>

<div class="nav">
  <ul>
    <li> <a href="https://www.juzihuang.com/"><img src="https://ww2.sinaimg.cn/large/a15b4afegy1fj5orc0s4pj202s02sq2t.jpg" alt="网站移动端下方固定导航按钮的方法"></a> </li>
    <li> <a href="https://www.juzihuang.com/jishu/"><img src="https://ww2.sinaimg.cn/large/a15b4afegy1fj5ormmj33j202s02smx1.jpg" alt="网站移动端下方固定导航按钮的方法"></a> </li>
    <li> <a href="https://www.juzihuang.com/ziyuan/"><img src="https://ww2.sinaimg.cn/large/a15b4afegy1fj5onpl6ohj202s02sglh.jpg" alt="网站移动端下方固定导航按钮的方法"></a> </li>
    <li> <a href="https://www.juzihuang.com/shenmu/"><img style="animation: blink 1.0s linear infinite;" src="https://ww2.sinaimg.cn/large/a15b4afegy1fj5p5z185rj202s02s0sm.jpg" alt="网站移动端下方固定导航按钮的方法"></a> </li>
    <li> <a href="https://www.juzihuang.com/doc/"><img src="https://ww2.sinaimg.cn/large/a15b4afegy1fjclu2gnghj202s02s745.jpg" alt="网站移动端下方固定导航按钮的方法"></a> </li>
  </ul>
</div>

使用方法

把该代码加入到网站首页模板中,该固定导航按钮将只展现在移动端首页。想要移动端全站展示,可以将以上代码添加到 footer 文件中。链接可自行替换,图片亦如此,替换修改成自己的即可。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-06-03发表,共计2051字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)