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

相关文章

使用Dify访问mysql数据库详细代码示例

《使用Dify访问mysql数据库详细代码示例》:本文主要介绍使用Dify访问mysql数据库的相关资料,并详细讲解了如何在本地搭建数据库访问服务,使用ngrok暴露到公网,并创建知识库、数据库访... 1、在本地搭建数据库访问的服务,并使用ngrok暴露到公网。#sql_tools.pyfrom

使用mvn deploy命令上传jar包的实现

《使用mvndeploy命令上传jar包的实现》本文介绍了使用mvndeploy:deploy-file命令将本地仓库中的JAR包重新发布到Maven私服,文中通过示例代码介绍的非常详细,对大家的学... 目录一、背景二、环境三、配置nexus上传账号四、执行deploy命令上传包1. 首先需要把本地仓中要

Spring Cloud之注册中心Nacos的使用详解

《SpringCloud之注册中心Nacos的使用详解》本文介绍SpringCloudAlibaba中的Nacos组件,对比了Nacos与Eureka的区别,展示了如何在项目中引入SpringClo... 目录Naacos服务注册/服务发现引⼊Spring Cloud Alibaba依赖引入Naco编程s依

Java springBoot初步使用websocket的代码示例

《JavaspringBoot初步使用websocket的代码示例》:本文主要介绍JavaspringBoot初步使用websocket的相关资料,WebSocket是一种实现实时双向通信的协... 目录一、什么是websocket二、依赖坐标地址1.springBoot父级依赖2.springBoot依赖

Java使用Mail构建邮件功能的完整指南

《Java使用Mail构建邮件功能的完整指南》JavaMailAPI是一个功能强大的工具,它可以帮助开发者轻松实现邮件的发送与接收功能,本文将介绍如何使用JavaMail发送和接收邮件,希望对大家有所... 目录1、简述2、主要特点3、发送样例3.1 发送纯文本邮件3.2 发送 html 邮件3.3 发送带

Nginx实现前端灰度发布

《Nginx实现前端灰度发布》灰度发布是一种重要的策略,它允许我们在不影响所有用户的情况下,逐步推出新功能或更新,通过灰度发布,我们可以测试新版本的稳定性和性能,下面就来介绍一下前端灰度发布的使用,感... 目录前言一、基于权重的流量分配二、基于 Cookie 的分流三、基于请求头的分流四、基于请求参数的分

使用DeepSeek搭建个人知识库(在笔记本电脑上)

《使用DeepSeek搭建个人知识库(在笔记本电脑上)》本文介绍了如何在笔记本电脑上使用DeepSeek和开源工具搭建个人知识库,通过安装DeepSeek和RAGFlow,并使用CherryStudi... 目录部署环境软件清单安装DeepSeek安装Cherry Studio安装RAGFlow设置知识库总

Python FastAPI入门安装使用

《PythonFastAPI入门安装使用》FastAPI是一个现代、快速的PythonWeb框架,用于构建API,它基于Python3.6+的类型提示特性,使得代码更加简洁且易于绶护,这篇文章主要介... 目录第一节:FastAPI入门一、FastAPI框架介绍什么是ASGI服务(WSGI)二、FastAP

Spring-AOP-ProceedingJoinPoint的使用详解

《Spring-AOP-ProceedingJoinPoint的使用详解》:本文主要介绍Spring-AOP-ProceedingJoinPoint的使用方式,具有很好的参考价值,希望对大家有所帮... 目录ProceedingJoinPoijsnt简介获取环绕通知方法的相关信息1.proceed()2.g

Maven pom.xml文件中build,plugin标签的使用小结

《Mavenpom.xml文件中build,plugin标签的使用小结》本文主要介绍了Mavenpom.xml文件中build,plugin标签的使用小结,文中通过示例代码介绍的非常详细,对大家的学... 目录<build> 标签Plugins插件<build> 标签<build> 标签是 pom.XML