UI前端-使用SVG拼水平六边形填充图文效果

2023-11-22 16:59

本文主要是介绍UI前端-使用SVG拼水平六边形填充图文效果,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

之前用SVG做的一个六边形区块链效果:

完整贴码:

css文件:

html,
body {
    height: 100%;
    width:100%;background:url(images/06.png) no-repeat center;
    overflow:hidden;
}
body {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    width: 100%;
}
svg {
    height:100%;
    width:1100px;
    margin:0 auto;
    margin-top:-150px;
}
svg polygon{stroke-width:3;stroke:#fff;stroke-opacity:1;}
svg polygon:hover{stroke-width:0;stroke:#fff;stroke-opacity:1; cursor:pointer;}

body内容:

<svg version="1.1" viewBox="0 0 477 300">
<defs>
      <pattern id="patter-1" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none"  xlink:href="images/CRMjg.png">
        </image>
      </pattern>
          <pattern id="patter-2" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none" xlink:href="images/CRMsf.png">
        </image>
      </pattern>
          <pattern id="patter-3" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none"  xlink:href="images/zpd.png">
        </image>
      </pattern>
          <pattern id="patter-4" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none"  xlink:href="images/zcd.png">
        </image>
      </pattern>
          <pattern id="patter-5" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none"  xlink:href="images/89.png">
        </image>
      </pattern>
          <pattern id="patter-6" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none" xlink:href="images/yzf.png">
        </image>
      </pattern>
          <pattern id="patter-7" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none"  xlink:href="images/td.png">
        </image>
      </pattern>
          <pattern id="patter-8" height="1" width="1" patternContentUnits="objectBoundingBox">
        <image height="1" width="1" preserveAspectRatio="none" xlink:href="images/ycdd.png">
        </image>
      </pattern>
  </defs>  
    <polygon fill="#FFAB93" points="260,150 282,187 260,225 217,225 195,187 217,150" Onclick="alert('1')"/>
    <polygon fill="url(#patter-1)" points="347,150 325,112 346.5,74.5 390,74 412,111 390,150"  Onclick="alert('11')"/>
    <polygon fill="url(#patter-2)" points="390,150 412,187 390,225 347,225 325,187 347,150" Onclick="alert('1')"/>
    <polygon fill="url(#patter-3)" points="130,150 152,187 130,225 87,225 65,187 87,150"  Onclick="alert('2')"/>
    <polygon fill="url(#patter-4)" points="152,187 130,150 152,113 195,113 217,150 195,187" Onclick="alert('3')"/>
    <polygon fill="url(#patter-5)" points="22,187 0,150 22,113 65,113 87,150 65,187"  Onclick="alert('4')"/>
    <polygon fill="url(#patter-6)" points="152,262 130,225 152,187 195,187 217,225 195.5,262.5" Onclick="alert('5')"/>
    <polygon fill="url(#patter-7)" points="412,187 390,150 412,111 455,112 477,150 455,187"  Onclick="alert('6')"/>
    <polygon fill="url(#patter-8)" points="282,262 260,225 282,187 325,187 347,225 325,262"  Onclick="alert('7')"/>
          <text style="fill:#fff;font-size:12pt" x="223" y="195">8</text>
</svg>
 

这篇关于UI前端-使用SVG拼水平六边形填充图文效果的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/411589

相关文章

Conda与Python venv虚拟环境的区别与使用方法详解

《Conda与Pythonvenv虚拟环境的区别与使用方法详解》随着Python社区的成长,虚拟环境的概念和技术也在不断发展,:本文主要介绍Conda与Pythonvenv虚拟环境的区别与使用... 目录前言一、Conda 与 python venv 的核心区别1. Conda 的特点2. Python v

Spring Boot中WebSocket常用使用方法详解

《SpringBoot中WebSocket常用使用方法详解》本文从WebSocket的基础概念出发,详细介绍了SpringBoot集成WebSocket的步骤,并重点讲解了常用的使用方法,包括简单消... 目录一、WebSocket基础概念1.1 什么是WebSocket1.2 WebSocket与HTTP

C#中Guid类使用小结

《C#中Guid类使用小结》本文主要介绍了C#中Guid类用于生成和操作128位的唯一标识符,用于数据库主键及分布式系统,支持通过NewGuid、Parse等方法生成,感兴趣的可以了解一下... 目录前言一、什么是 Guid二、生成 Guid1. 使用 Guid.NewGuid() 方法2. 从字符串创建

Python使用python-can实现合并BLF文件

《Python使用python-can实现合并BLF文件》python-can库是Python生态中专注于CAN总线通信与数据处理的强大工具,本文将使用python-can为BLF文件合并提供高效灵活... 目录一、python-can 库:CAN 数据处理的利器二、BLF 文件合并核心代码解析1. 基础合

Python使用OpenCV实现获取视频时长的小工具

《Python使用OpenCV实现获取视频时长的小工具》在处理视频数据时,获取视频的时长是一项常见且基础的需求,本文将详细介绍如何使用Python和OpenCV获取视频时长,并对每一行代码进行深入解析... 目录一、代码实现二、代码解析1. 导入 OpenCV 库2. 定义获取视频时长的函数3. 打开视频文

Spring IoC 容器的使用详解(最新整理)

《SpringIoC容器的使用详解(最新整理)》文章介绍了Spring框架中的应用分层思想与IoC容器原理,通过分层解耦业务逻辑、数据访问等模块,IoC容器利用@Component注解管理Bean... 目录1. 应用分层2. IoC 的介绍3. IoC 容器的使用3.1. bean 的存储3.2. 方法注

Python内置函数之classmethod函数使用详解

《Python内置函数之classmethod函数使用详解》:本文主要介绍Python内置函数之classmethod函数使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录1. 类方法定义与基本语法2. 类方法 vs 实例方法 vs 静态方法3. 核心特性与用法(1编程客

Linux中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

使用Python实现可恢复式多线程下载器

《使用Python实现可恢复式多线程下载器》在数字时代,大文件下载已成为日常操作,本文将手把手教你用Python打造专业级下载器,实现断点续传,多线程加速,速度限制等功能,感兴趣的小伙伴可以了解下... 目录一、智能续传:从崩溃边缘抢救进度二、多线程加速:榨干网络带宽三、速度控制:做网络的好邻居四、终端交互

Python中注释使用方法举例详解

《Python中注释使用方法举例详解》在Python编程语言中注释是必不可少的一部分,它有助于提高代码的可读性和维护性,:本文主要介绍Python中注释使用方法的相关资料,需要的朋友可以参考下... 目录一、前言二、什么是注释?示例:三、单行注释语法:以 China编程# 开头,后面的内容为注释内容示例:示例:四