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

相关文章

java中pdf模版填充表单踩坑实战记录(itextPdf、openPdf、pdfbox)

《java中pdf模版填充表单踩坑实战记录(itextPdf、openPdf、pdfbox)》:本文主要介绍java中pdf模版填充表单踩坑的相关资料,OpenPDF、iText、PDFBox是三... 目录准备Pdf模版方法1:itextpdf7填充表单(1)加入依赖(2)代码(3)遇到的问题方法2:pd

python使用try函数详解

《python使用try函数详解》Pythontry语句用于异常处理,支持捕获特定/多种异常、else/final子句确保资源释放,结合with语句自动清理,可自定义异常及嵌套结构,灵活应对错误场景... 目录try 函数的基本语法捕获特定异常捕获多个异常使用 else 子句使用 finally 子句捕获所

C++11右值引用与Lambda表达式的使用

《C++11右值引用与Lambda表达式的使用》C++11引入右值引用,实现移动语义提升性能,支持资源转移与完美转发;同时引入Lambda表达式,简化匿名函数定义,通过捕获列表和参数列表灵活处理变量... 目录C++11新特性右值引用和移动语义左值 / 右值常见的左值和右值移动语义移动构造函数移动复制运算符

Python对接支付宝支付之使用AliPay实现的详细操作指南

《Python对接支付宝支付之使用AliPay实现的详细操作指南》支付宝没有提供PythonSDK,但是强大的github就有提供python-alipay-sdk,封装里很多复杂操作,使用这个我们就... 目录一、引言二、准备工作2.1 支付宝开放平台入驻与应用创建2.2 密钥生成与配置2.3 安装ali

C#中lock关键字的使用小结

《C#中lock关键字的使用小结》在C#中,lock关键字用于确保当一个线程位于给定实例的代码块中时,其他线程无法访问同一实例的该代码块,下面就来介绍一下lock关键字的使用... 目录使用方式工作原理注意事项示例代码为什么不能lock值类型在C#中,lock关键字用于确保当一个线程位于给定实例的代码块中时

MySQL 强制使用特定索引的操作

《MySQL强制使用特定索引的操作》MySQL可通过FORCEINDEX、USEINDEX等语法强制查询使用特定索引,但优化器可能不采纳,需结合EXPLAIN分析执行计划,避免性能下降,注意版本差异... 目录1. 使用FORCE INDEX语法2. 使用USE INDEX语法3. 使用IGNORE IND

C# $字符串插值的使用

《C#$字符串插值的使用》本文介绍了C#中的字符串插值功能,详细介绍了使用$符号的实现方式,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧... 目录$ 字符使用方式创建内插字符串包含不同的数据类型控制内插表达式的格式控制内插表达式的对齐方式内插表达式中使用转义序列内插表达式中使用

flask库中sessions.py的使用小结

《flask库中sessions.py的使用小结》在Flask中Session是一种用于在不同请求之间存储用户数据的机制,Session默认是基于客户端Cookie的,但数据会经过加密签名,防止篡改,... 目录1. Flask Session 的基本使用(1) 启用 Session(2) 存储和读取 Se

Java Thread中join方法使用举例详解

《JavaThread中join方法使用举例详解》JavaThread中join()方法主要是让调用改方法的thread完成run方法里面的东西后,在执行join()方法后面的代码,这篇文章主要介绍... 目录前言1.join()方法的定义和作用2.join()方法的三个重载版本3.join()方法的工作原

Spring AI使用tool Calling和MCP的示例详解

《SpringAI使用toolCalling和MCP的示例详解》SpringAI1.0.0.M6引入ToolCalling与MCP协议,提升AI与工具交互的扩展性与标准化,支持信息检索、行动执行等... 目录深入探索 Spring AI聊天接口示例Function CallingMCPSTDIOSSE结束语