应无所住,而生其心
排名
1
文章
860
粉丝
112
评论
163
net core webapi post传递参数
庸人 : 确实坑哈,我也是下班好了好几次,发现后台传递对象是可以的,但...
百度编辑器自定义模板
庸人 : 我建议换个编辑器,因为现在百度富文本已经停止维护了,用tinymec...
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术

css3印章效果

11471人阅读 2020/8/14 10:05 总访问:5194584 评论:0 收藏:1 手机
分类: CSS

配合bootstrap4来写的,效果图

直接贴代码吧:
直接复制运行即可看到效果:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="utf-8" />
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6.     <title>写样式中......</title>
  7.     <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  8.     <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  9.     <style type="text/css">
  10.         .box {
  11.             position: relative;
  12.             overflow: hidden;
  13.             height260px;
  14.         }
  15.         .box img {
  16.             width100%;
  17.             height260px;
  18.         }
  19.         .box .box-content {
  20.             width100%;
  21.             height100%;
  22.             position: absolute;
  23.             top0;
  24.             left0;
  25.             color#fff;
  26.             text-align: center;
  27.             padding20% 20px;
  28.             backgroundrgba(0, 0, 0, 0.6);
  29.             transformrotate(-90deg);
  30.             transform-origin: left top 0;
  31.             transition: all 0.50s ease 0s;
  32.         }
  33.         .box .title {
  34.             display: inline-block;
  35.             font-size22px;
  36.             color#fff;
  37.             margin0 0 15px 0;
  38.             position: relative;
  39.             transformrotate(180deg);
  40.             transform-origin: right top 0;
  41.             transition: all .3s ease-in-out 0.2s;
  42.         }
  43.         .box .post {
  44.             display: block;
  45.             font-size18px;
  46.             margin-bottom15px;
  47.             transformrotate(180deg);
  48.             transform-origin: right top 0;
  49.             transition: all .3s ease-in-out 0.4s;
  50.         }
  51.         .box .description {
  52.             font-size15px;
  53.             margin-bottom20px;
  54.             padding0 20px;
  55.             transformrotate(180deg);
  56.             transform-origin: right top 0;
  57.             transition: all .3s ease-in-out 0.6s;
  58.         }
  59.         .box .read {
  60.             font-size16px;
  61.             font-weight: bold;
  62.             color#fff;
  63.             display: block;
  64.             letter-spacing2px;
  65.             text-transform: uppercase;
  66.             transformrotate(180deg);
  67.             transform-origin: right top 0;
  68.             transition: all 0.3s ease-in-out 0.8s;
  69.         }
  70.         .box .read:hover {
  71.             color#e8802e;
  72.             text-decoration: none;
  73.         }
  74.         .box:hover .box-content,
  75.         .box:hover .title,
  76.         .box:hover .post,
  77.         .box:hover .description,
  78.         .box:hover .read {
  79.             transformrotate(0deg);
  80.         }
  81.     </style>
  82.     <style>
  83.         @media (min-width: 1200px) {
  84.             .container {
  85.                 max-width1200px;
  86.             }
  87.         }
  88.         @media (min-width: 1440px) {
  89.             .container {
  90.                 max-width1260px;
  91.             }
  92.         }
  93.         @media (min-width: 1600px) {
  94.             .container {
  95.                 max-width1350px;
  96.             }
  97.         }
  98.         .professional_container .myborder {
  99.             /* box-sizing: border-box;
  100.             -moz-box-sizing: border-box;
  101.             -webkit-box-sizing: border-box; */
  102.             border1px solid #cbd1d6;
  103.             /* Safari */
  104.         }
  105.         .professional_item {
  106.             /* height: 115px; */
  107.             /* margin: 0px 0px 16px 0px; */
  108.             /* padding-top: 10px;
  109.             padding-bottom: 6px; */
  110.             cursor: pointer;
  111.             margin15px 15px 0px 15px;
  112.             height260px;
  113.         }
  114.     </style>
  115.     <style type="text/css" name="文字盖章">
  116.         .seal-content {
  117.             width300px;
  118.             min-height60px;
  119.             vertical-align: bottom;
  120.             word-wrap: break-word;
  121.             position: relative;
  122.         }
  123.         .seal-result {
  124.             width60px;
  125.             height60px;
  126.             transformrotate(20deg);
  127.             border: solid 2px green;
  128.             border-radius100%;
  129.             text-align: center;
  130.             color: green;
  131.             font-size16px;
  132.             font-weight: bold;
  133.             line-height60px;
  134.             right5px;
  135.             bottom12px;
  136.             position: absolute;
  137.             background-colorrgba(255, 255, 255, 0.8)
  138.         }
  139.         .seal-result-fail {
  140.             border-color: red;
  141.             color: red;
  142.         }
  143.     </style>
  144.     <body>
  145.         <header>
  146.         </header>
  147.         <div>
  148.             <div style="margin-top:36px">
  149.                 <div style="font-weight: 600;font-size: 20px">培训方式</div>
  150.                 <div class="row border" style="margin-top: 20px;background: #fff;margin-left: 0px;margin-right: 0px">
  151.                     <div style="color:#444;padding: 20px">
  152.                         <span style="font-size: 15px;margin-top: 6px;clear: both;line-height: 1.8">
  153.                             学院是西南地区较早开展IT互联网人才培养的教育品牌。通过十余年的发展与积淀,学院形成以大数据软件开发、手机应用、人工智能、游戏开发、无人机、VR、3D打印、室内装潢、电子商务等为主的多方向专业培养体系,并通过足下校园、足下课堂等线上平台提供就业创业、学习进修、转行猎头、人才外派等专业人才服务。如今,学院已形成了集互联网应用教育、课程体系与教材研发、教学管理、人才培养和人才服务、实习实训、招生就业服务、产业孵化、软件研发、服务外包、信息化建设等“产、学、研”一体化协同发展的生态系统,研发的134本教材被15个省市的50多所院校采用。学院秉承“培养五百万行业精英”的集团目标,通过“技术-健康-思维”三个维度。“技术型、管理型、创业型”高端软件人才。学院与加拿大荷兰学院、新加坡立腾学院等国际院校的合作,更是开创了国际办学和人才交流的新模式。
  154.                         </span>
  155.                         <div style="position: absolute;top: 0px;right: 0px;background-color: rgba(255, 255, 255, 0.8)">
  156.                             <canvas id="canvas" width="163" height="163"></canvas>
  157.                         </div>
  158.                     </div>
  159.                 </div>
  160.             </div>
  161.             <div style="margin-top:32px">
  162.                 <div style="font-weight: 600;font-size: 20px">岗位师资认证培训</div>
  163.                 <div class="row border" style="margin-top: 20px;background: #fff;margin-left: 0px;margin-right: 0px">
  164.                     <div style="color:#444;padding: 30px">
  165.                         <span style="font-size: 15px;margin-top: 6px;clear: both;line-height: 1.8">
  166.                             模块一:JAVA开发工程师-讲师资格认证
  167.                         </span>
  168.                         <div class="seal-result seal-result-fail">不通过</div>
  169.                     </div>
  170.                 </div>
  171.                 <div class="row border" style="margin-top: 20px;background: #fff;margin-left: 0px;margin-right: 0px">
  172.                     <div style="color:#444;padding: 30px">
  173.                         <span style="font-size: 15px;margin-top: 6px;clear: both;line-height: 1.8">
  174.                             模块一:JAVA开发工程师-讲师资格认证
  175.                         </span>
  176.                         <div>通过</div>
  177.                     </div>
  178.                 </div>
  179.                 <div class="row border" style="margin-top: 20px;background: #fff;margin-left: 0px;margin-right: 0px">
  180.                     <div style="color:#444;padding: 30px">
  181.                         <span style="font-size: 15px;margin-top: 6px;clear: both;line-height: 1.8">
  182.                             模块一:JAVA开发工程师-讲师资格认证
  183.                         </span>
  184.                         <div>通过</div>
  185.                     </div>
  186.                 </div>
  187.                 <div class="row border" style="margin-top: 20px;background: #fff;margin-left: 0px;margin-right: 0px">
  188.                     <div style="color:#444;padding: 30px">
  189.                         <span style="font-size: 15px;margin-top: 6px;clear: both;line-height: 1.8">
  190.                             模块一:JAVA开发工程师-讲师资格认证
  191.                         </span>
  192.                         <div class="seal-result seal-result-fail">不通过</div>
  193.                     </div>
  194.                 </div>
  195.             </div>
  196.         </div>
  197.         </div>
  198.         <div class="jumbotron text-center" style="margin-bottom:0;margin-top: 30px">
  199.             <p>tnblog版权所有2018-2020</p>
  200.         </div>
  201.         <!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单,包含了 popper.min.js -->
  202.         <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
  203.         <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  204.         <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
  205.         <script>
  206.         </script>
  207.         <script name="自定义印章">
  208.             var canvas = document.getElementById("canvas");
  209.             var context = canvas.getContext('2d');
  210.             var text = "TNBLOG";
  211.             var companyName = "博客科技有限公司";
  212.             // 绘制印章边框
  213.             var width = canvas.width / 2;
  214.             var height = canvas.height / 2;
  215.             context.lineWidth = 4;
  216.             context.strokeStyle = "#f00";
  217.             context.beginPath();
  218.             context.arc(width, height, 720Math.PI * 2);//宽、高、半径(半径用来跳转外圈的大小)
  219.             context.stroke();
  220.             //画五角星
  221.             create5star(context, width, height, 25"#f00"0);
  222.             // 绘制印章名称
  223.             context.font = '16px 宋体';
  224.             context.textBaseline = 'middle';//设置文本的垂直对齐方式
  225.             context.textAlign = 'center'//设置文本的水平对对齐方式
  226.             context.lineWidth = 1;
  227.             context.strokeStyle = '#f00';
  228.             context.strokeText(text, width, height + 50);
  229.             // 绘制印章单位  
  230.             context.translate(width, height);// 平移到此位置,
  231.             context.font = '20px 宋体';
  232.             var count = companyName.length;// 字数
  233.             var angle = 4 * Math.PI / (3 * (count - 1));// 字间角度 
  234.             var chars = companyName.split("");
  235.             var c;
  236.             for (var i = 0; i < count; i++) {
  237.                 c = chars[i];// 需要绘制的字符   
  238.                 if (i == 0) {
  239.                     context.rotate(5 * Math.PI / 6);
  240.                 } else {
  241.                     context.rotate(angle);
  242.                 }
  243.                 context.save();
  244.                 context.translate(560);// 平移到此位置,此时字和x轴垂直,公司名称和最外圈的距离
  245.                 context.rotate(Math.PI / 2);// 旋转90度,让字平行于x轴
  246.                 context.strokeText(c, 00);// 此点为字的中心点
  247.                 context.restore();
  248.             }
  249.             //绘制五角星
  250.             function create5star(context, sx, sy, radius, color, rotato{
  251.                 context.save();
  252.                 context.fillStyle = color;
  253.                 context.translate(sx, sy);//移动坐标原点
  254.                 context.rotate(Math.PI + rotato);//旋转
  255.                 context.beginPath();//创建路径
  256.                 var x = Math.sin(0);
  257.                 var y = Math.cos(0);
  258.                 var dig = Math.PI / 5 * 4;
  259.                 for (var i = 0; i < 5; i++) {//画五角星的五条边
  260.                     var x = Math.sin(i * dig);
  261.                     var y = Math.cos(i * dig);
  262.                     context.lineTo(x * radius, y * radius);
  263.                 }
  264.                 context.closePath();
  265.                 context.stroke();
  266.                 context.fill();
  267.                 context.restore();
  268.             }
  269.         </script>
  270.     </body>
  271. </html>


欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)

评价

css3样式学习代码

上代码!上代码!不说了&lt;!DOCTYPEhtml&gt; &lt;htmllang=&quot;en&quot;&gt; &lt;head&gt; &lt;metacharset=&quot;UT...

HTML+css3+js 实现生日快乐代码,动态生成效果

&lt;!DOCTYPEhtml&gt; &lt;html&gt; &lt;head&gt; &lt;metacharset=&quot;UTF-8&quot;&gt; &lt;title&gt;生日快乐&lt;/...

css3过渡渐变

code:&lt;!DOCTYPEhtml&gt; &lt;html&gt; &lt;head&gt; &lt;metacharset=&quot;utf-8&quot;&gt; &lt;title&gt;菜鸟教程...

css3 background-size

语法:div { background:url(img_flwr.gif); background-size:80px60px; background-repeat:no-repeat; }可以设置成10...

css3实现边框旋转但内容不动

其实思路就是把文字旋转的角度反向旋转抵消掉div旋转的角度即可 &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; ...

css3 中的 nth-child

:nth-child(n)选择器用来定位某个父元素的一个或多个特定的子元素。其中“n”是其参数,而且可以是整数值(1,2,3,4),也可以...

css3伪类选择器 nth-child , 循环变色,循环颜色。css最后一个元素

选中第一个元素:.container&gt;div:first-child{ background:#abcdff; }选中最后一个可以使用last-child.container&gt;d...

css3 伪类选择器 before和after。实现简单的标题。清楚浮动。红黄蓝效果。实现下方横线((下划线 ,下横线)),Tab菜单效果

[TOC]伪类选择器before和after,实现一个简单的标题效果 代码如下 &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;...

css3 实现ps文字外发光效果实现一串文字背后灯光高亮效果。实现文字发光。css实现实现文字背景高亮

CSS3 并没有直接设置发光效果的属性,但是利用text-shadow属性实现此效果text-shadow: h-shadow v-shadow blur color; 参...

使用css3实现一个不规则div的布局

要实现不规则的div布局,可以使用CSS3的clip-path属性。该属性可以剪切元素的形状,从而实现不规则的布局。以下是一个示例...

css3 渐变 两边浅中间深。由中间向两边。 div边框渐变色

设计图是这样的 可以使用线性渐变语法:background: linear-gradient(direction, color-stop1, color-stop2, …)例如从...