当前位置: 首页 > wzjs >正文

广州地区做网站的企点qq

广州地区做网站的,企点qq,网站域名到期了怎么办,哪里可以做网站背景 最近在学习前端css样式,flex布局。可以实现各种图形。之前每次发博客都为找不到合适的图片而苦恼。刚好前端画好页面后,引入html2canvas的js库,可以直接下载图片,很好地满足了我的需求。现在分享一下学习成果,希…

背景

最近在学习前端css样式,flex布局。可以实现各种图形。之前每次发博客都为找不到合适的图片而苦恼。刚好前端画好页面后,引入html2canvas的js库,可以直接下载图片,很好地满足了我的需求。现在分享一下学习成果,希望对你也有帮助。

案例一

1、效果

在这里插入图片描述

2、代码

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>html画文章封面图</title><script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script><style lang="scss" scoped>#box {display: flex;justify-content: space-between;flex-wrap: wrap;width: 700px;height: 410px;border: 1px solid gray;row-gap: 10px;}.div1 {width: 0px;height: 0px;border-top: 100px solid transparent;border-left: 100px solid transparent;border-right: 100px solid transparent;border-bottom: 100px solid green;}.div2 {width: 0px;height: 0px;border: 100px solid;border-color: transparent transparent blue transparent;}.div3 {width: 200px;height: 200px;background: linear-gradient(45deg, deeppink, yellowgreen);}.div4 {width: 200px;height: 200px;background: linear-gradient(45deg, deeppink, yellowgreen 50%, yellowgreen 50%, deeppink 100%);}.div5 {width: 200px;height: 200px;border-radius: 50%;background-color: pink;}.div6 {width: 100px;height: 200px;border-radius: 100px 0px 0px 100px;background: red;}.div7 {margin-top: 50px;width: 100px;height: 50px;border-radius: 0px 0px 50px 50px;border-bottom: 10px solid #111111;box-sizing: border-box;border-top: none;}.btn{margin-top: 10px;margin-left: 10px;}</style>
</head>
<body>
<div id="box"><div class="div1"></div><div class="div2"></div><div class="div3"></div><div class="div4"></div><div class="div5"></div><div class="div6"></div><div class="div7"></div>
</div>
<button class="btn" onclick="capture()">生成图片</button>
<script>function capture() {html2canvas(document.getElementById('box'), {useCORS: true,allowTaint: false,scale: 1}).then(canvas => {var link = document.createElement('a');link.href = canvas.toDataURL("image/png");const now = new Date();link.download = formatDateTime(now)+'.png';link.click();});}function formatDateTime(date) {const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, '0'); // 注意:月份是从0开始的const day = String(date.getDate()).padStart(2, '0');const hours = String(date.getHours()).padStart(2, '0');const minutes = String(date.getMinutes()).padStart(2, '0');const seconds = String(date.getSeconds()).padStart(2, '0');return `${year}${month}${day}${hours}${minutes}${seconds}`;}
</script>
</body>
</html>

案例二

1、效果

在这里插入图片描述

2、代码

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>html画文章封面图</title><script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script><style lang="scss" scoped>#box {height: 410px;width: 700px;border: 1px solid gray;display: flex;flex-direction: column;background-color: #3B7ABF;font-weight: bold;}.div1 {height: 350px;line-height: 350px;font-size: 50px;color: white;;justify-content: center;text-align: center;}.div2 {height: 60px;line-height: 60px;font-size: 20px;color:#BF9C0E;justify-content: center;text-align: right;margin-right: 20px;}.btn{margin-top: 10px;margin-left: 10px;}</style>
</head>
<body>
<div id="box"><div class="div1">这是html画的封面图</div><div class="div2">———创作于2025-05-05</div>
</div>
<button class="btn" onclick="capture()">生成图片</button>
<script>function capture() {html2canvas(document.getElementById('box'), {useCORS: true,allowTaint: false,scale: 1}).then(canvas => {var link = document.createElement('a');link.href = canvas.toDataURL("image/png");const now = new Date();link.download = formatDateTime(now)+'.png';link.click();});}function formatDateTime(date) {const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, '0'); // 注意:月份是从0开始的const day = String(date.getDate()).padStart(2, '0');const hours = String(date.getHours()).padStart(2, '0');const minutes = String(date.getMinutes()).padStart(2, '0');const seconds = String(date.getSeconds()).padStart(2, '0');return `${year}${month}${day}${hours}${minutes}${seconds}`;}
</script>
</body>
</html>
http://www.dtcms.com/wzjs/482929.html

相关文章:

  • 网站开发前期功能策划关键词搜索
  • node.js 网站开发成都搜索优化排名公司
  • 淘宝上做网站的靠谱广告推广投放平台
  • wordpress重定向自定义百度seo推广工具
  • 做一元购网站长沙网站seo收费
  • 做外销b2b网站对比网站关键词挖掘
  • 局域网站建设热点新闻事件及评论
  • 福州做网站价格推广平台都有哪些
  • 犀牛云做网站骗人企业整站推广
  • 软件免费开发网站建设杭州网络优化公司排名
  • 石家庄市住房和城乡建设局官方网站头条今日头条新闻
  • 怎么做色情网站赚钱申请网站域名要多少钱
  • 远程时代网站建设win7优化大师好不好
  • 网站开发知识版权百度关键词分析
  • 网站模块插件是怎么做的seo+网站排名
  • 网站建设-猴王网络百度文库网页版登录入口
  • 网站建设的一般过程成都百度
  • 徐州建设工程网上交易平台武汉seo工作室
  • 阿里云模板建站好不好网络推广怎么做好
  • 上海百度公司总部seo点击工具帮你火21星热情
  • 无锡网站建设技术外包如何引流被动加好友微信
  • 商城网站模版代码seo排名优化厂家
  • 网站 沙盒品牌推广工作内容
  • 网站建设方面的知识抖音指数
  • 怎样在网站上做外贸青岛百度网站排名
  • 专门做母婴的网站有哪些电商平台建设方案
  • 渐变配色网站网站名查询网址
  • 网站建设用苹果系统与liunx什么是搜索引擎营销?
  • 河北网站设计推荐柚米科技查企业信息查询平台
  • 海南医院网站建设软文关键词排名推广