html5+CSS3鼠标划过样式导航菜单代码

 时间:2026-02-16 22:47:07

1、新建html文档。

html5+CSS3鼠标划过样式导航菜单代码

2、书写hmtl代码。

<div id="workarea">

 <div class="position"> 

  <div class="svg-wrapper"> <svg height="40

   <rect id="shape" height="40

   <div id="text"> <a href=""><span class="spot"></span>Button 1</a> </div>

   </svg> </div>

  <div class="svg-wrapper"> <svg height="40

   <rect id="shape" height="40

   <div id="text"> <a href=""><span class="spot"></span>Button 2</a> </div>

   </svg> </div>

  <div class="svg-wrapper"> <svg height="40

   <rect id="shape" height="40

   <div id="text"> <a href=""><span class="spot"></span>Button 3</a> </div>

   </svg> </div>

 </div>

</div>

html5+CSS3鼠标划过样式导航菜单代码

3、书写css代码。

<style>

* { margin: 0; padding: 0 }

html, css { width: 100%; height: 100% }

.position { margin-left: auto; margin-right: auto; text-align: center; margin-top: 15% }

#workarea { position: absolute; width: 100%; height: 100%; background-color: #1e1a3e; font-family: Raleway }

#personal { color: white; text-decoration: none; position: absolute; bottom: 15px; right: 2% }

.spot { position: absolute; width: 100%; height: 100%; top: 0; left: 0 }

.svg-wrapper { margin-top: 0; position: relative; width: 150px; height: 40px; display: inline-block; border-radius: 3px; margin-left: 5px; margin-right: 5px }

#shape { stroke-width: 6px; fill: transparent; stroke: #009FFD; stroke-dasharray: 85 400; stroke-dashoffset: -220; transition: 1s all ease }

#text { margin-top: -35px; text-align: center }

#text a { color: white; text-decoration: none; font-weight: 100; font-size: 1.1em }

.svg-wrapper:hover #shape { stroke-dasharray: 50 0; stroke-width: 3px; stroke-dashoffset: 0; stroke: #06D6A0 }

</style>

html5+CSS3鼠标划过样式导航菜单代码

4、hmtl代码整体结构。

html5+CSS3鼠标划过样式导航菜单代码

5、查看效果。

html5+CSS3鼠标划过样式导航菜单代码

html5+CSS3鼠标划过样式导航菜单代码

  • css如何让a标签上下间距相等
  • 如何让div里img图片水平垂直居中
  • HTML教程 audio标签的使用
  • css3设置字体阴影
  • DW网页教程基础篇-html部分常用标签简介
  • 热门搜索
    药水哥为什么被永封 端午节为什么要赛龙舟 我的世界玻璃怎么做 猪肉大葱饺子馅的做法 微信视频聊天怎么开美颜 小龙虾怎么清洗 孔子被后人尊称为什么 先进事迹材料怎么写 肾结石怎么治最好 海米的做法