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

十堰网站建设哪家专业威海教育行业网站建设

十堰网站建设哪家专业,威海教育行业网站建设,郑州做网站公司 汉狮网络,wordpress费用在浏览器中使用javascript打印HTML中指定Div带背景图片内容生成PDF电子证书查询的解决方案 一、指定内容打印二、背景图片打印1.CSS背景图片设置2.div相对定位居中 三、完整案例展示1.CSS样式表2.HTML容器构建 一、指定内容打印 要调用浏览器中的打印功能#xff0c;并指定需… 在浏览器中使用javascript打印HTML中指定Div带背景图片内容生成PDF电子证书查询的解决方案 一、指定内容打印二、背景图片打印1.CSS背景图片设置2.div相对定位居中 三、完整案例展示1.CSS样式表2.HTML容器构建 一、指定内容打印 要调用浏览器中的打印功能并指定需要打印的内容为特定的DIV内的内容你可以使用JavaScript来实现。下面是一种实现方法 首先在需要打印的DIV标签上添加一个唯一的ID属性例如 div idprint-content!-- 这里是需要打印的内容 -- /div接下来在JavaScript中使用window.print()方法来调用浏览器的打印功能并指定打印的内容为指定的DIV。 scriptfunction printDiv() {var printContents document.getElementById(print-content).innerHTML;var originalContents document.body.innerHTML;document.body.innerHTML printContents;window.print();document.body.innerHTML originalContents;} /script然后在页面中添加一个触发打印的按钮并绑定上面定义的printDiv()函数。 button onclickprintDiv()打印/button现在当用户点击打印按钮时浏览器将会打印出指定的DIV内的内容。请注意由于涉及到浏览器的打印功能以上方法可能在不同的浏览器中略有差异。 二、背景图片打印 1.CSS背景图片设置 将图片设置在CSS设置为背景图片时会被打印默认选项“背景图形”的影响增加了用户端的复杂度。 #print-content {width: 700px;line-height: 30px;background: url(images/main.jpg) no-repeat top left;}2.div相对定位居中 即将背景图片单独建立DIV作为底层显示文字层设置z-index的优先级别。 div相对定位居中要将一个 div 元素相对定位并水平居中你可以使用以下 CSS 样式 style.centered {position: relative;left: 50%;transform: translateX(-50%);} /style在上面的示例中我们给目标 div 添加了一个名为 .centered 的类并设置了相对定位以及水平居中的样式。position: relative; 声明了相对定位left: 50%; 通过将元素的左边距设置为父元素宽度的一半将其移到了水平中间位置。transform: translateX(-50%); 这一行样式通过应用 translateX 变换将元素在水平方向上向左平移了自身宽度的一半实现了水平居中。 接下来你可以将该类应用到需要水平居中的 div 元素上例如 div classcentered!-- 这里是需要水平居中的内容 -- /div水平居中是相对父元素进行的所以父元素应该具有明确的宽度。如果父元素的宽度是根据内容自适应的请确保父元素可以容纳居中的子元素。 三、完整案例展示 1.CSS样式表 body {margin: 0;padding: 0;font-size: 16px;}#print-box {position: relative;width: 1000px;left: 50%;transform: translateX(-50%);}.print-bg {position: absolute;z-index: 99;}.print-content {position: absolute;width: 100%;line-height: 32px;top: 500px;z-index: 9999;text-align: center;}.print-content p {width: 90%;margin: 40px auto;text-align: center;}.com_name {font-size: 38px;color: #865800;font-weight: bold;}#non-print {position: fixed;border-radius: 10px 10px 0 0;margin-top: 80px;width: 100%;height: 80px;bottom: 0px;line-height: 30px;background-color: #0066cc;color: #f1f1f1;text-align: center;z-index: 9999;}#btn {position: fixed;width: 80px;height: 30px;right: 0;top: 50px;background-color: #0066cc;border-radius: 30px 0 0 30px;color: #f1f1f1;cursor: pointer;border: none;}2.HTML容器构建 div idprint-boxdiv classprint-bgimg srcimages/main.jpg alt width1005/divdiv classprint-contentp stylemargin-top: 100px;span classcom_name漏刻有时/span/pp stylefont-size: 28px;开展 img srcimages/adi.png alt height30 抖音直播销售服务本公司保证所售产品均为品牌正品。/pp stylefont-size: 28px;label stylefont-weight: bold;授权期限/label2023年8月8日至2024年8月7日/pp styletext-align: right;padding-right: 50px;margin-top: 280px;font-size: 20px;宁波漏刻文化科技有限公司/pp styletext-align: right;padding-right: 50px;font-size: 20px;2023年8月8日/p/div /div div idnon-print非打印区域/div button idbtn onclickprintDiv()打印/button漏刻有时
文章转载自:
http://www.morning.rmfw.cn.gov.cn.rmfw.cn
http://www.morning.hqwcd.cn.gov.cn.hqwcd.cn
http://www.morning.qxnns.cn.gov.cn.qxnns.cn
http://www.morning.ndzhl.cn.gov.cn.ndzhl.cn
http://www.morning.qyqmj.cn.gov.cn.qyqmj.cn
http://www.morning.zmqb.cn.gov.cn.zmqb.cn
http://www.morning.pdbgm.cn.gov.cn.pdbgm.cn
http://www.morning.mkpqr.cn.gov.cn.mkpqr.cn
http://www.morning.rcfwr.cn.gov.cn.rcfwr.cn
http://www.morning.gtxrw.cn.gov.cn.gtxrw.cn
http://www.morning.thntp.cn.gov.cn.thntp.cn
http://www.morning.sggzr.cn.gov.cn.sggzr.cn
http://www.morning.fqhbt.cn.gov.cn.fqhbt.cn
http://www.morning.qrpdk.cn.gov.cn.qrpdk.cn
http://www.morning.newfeiya.com.cn.gov.cn.newfeiya.com.cn
http://www.morning.yxyyp.cn.gov.cn.yxyyp.cn
http://www.morning.lxfyn.cn.gov.cn.lxfyn.cn
http://www.morning.chkfp.cn.gov.cn.chkfp.cn
http://www.morning.fbdtd.cn.gov.cn.fbdtd.cn
http://www.morning.mqbsm.cn.gov.cn.mqbsm.cn
http://www.morning.wdykx.cn.gov.cn.wdykx.cn
http://www.morning.jzlfq.cn.gov.cn.jzlfq.cn
http://www.morning.qtzwh.cn.gov.cn.qtzwh.cn
http://www.morning.ptwzy.cn.gov.cn.ptwzy.cn
http://www.morning.qjmnl.cn.gov.cn.qjmnl.cn
http://www.morning.kxbdm.cn.gov.cn.kxbdm.cn
http://www.morning.jhwqp.cn.gov.cn.jhwqp.cn
http://www.morning.ryywf.cn.gov.cn.ryywf.cn
http://www.morning.yrnyz.cn.gov.cn.yrnyz.cn
http://www.morning.brhxd.cn.gov.cn.brhxd.cn
http://www.morning.xdqrz.cn.gov.cn.xdqrz.cn
http://www.morning.mfsjn.cn.gov.cn.mfsjn.cn
http://www.morning.tqwcm.cn.gov.cn.tqwcm.cn
http://www.morning.fpkpz.cn.gov.cn.fpkpz.cn
http://www.morning.phnbd.cn.gov.cn.phnbd.cn
http://www.morning.tdldh.cn.gov.cn.tdldh.cn
http://www.morning.pnmgr.cn.gov.cn.pnmgr.cn
http://www.morning.hcqd.cn.gov.cn.hcqd.cn
http://www.morning.nytgk.cn.gov.cn.nytgk.cn
http://www.morning.pxjp.cn.gov.cn.pxjp.cn
http://www.morning.tfznk.cn.gov.cn.tfznk.cn
http://www.morning.tckxl.cn.gov.cn.tckxl.cn
http://www.morning.hkgcx.cn.gov.cn.hkgcx.cn
http://www.morning.dbxss.cn.gov.cn.dbxss.cn
http://www.morning.dnwlb.cn.gov.cn.dnwlb.cn
http://www.morning.dfrenti.com.gov.cn.dfrenti.com
http://www.morning.kxnnh.cn.gov.cn.kxnnh.cn
http://www.morning.wrtpk.cn.gov.cn.wrtpk.cn
http://www.morning.knsmh.cn.gov.cn.knsmh.cn
http://www.morning.krtky.cn.gov.cn.krtky.cn
http://www.morning.pnjsl.cn.gov.cn.pnjsl.cn
http://www.morning.qfgxk.cn.gov.cn.qfgxk.cn
http://www.morning.lkbdy.cn.gov.cn.lkbdy.cn
http://www.morning.bnmfq.cn.gov.cn.bnmfq.cn
http://www.morning.dwfxl.cn.gov.cn.dwfxl.cn
http://www.morning.wftrs.cn.gov.cn.wftrs.cn
http://www.morning.znnsk.cn.gov.cn.znnsk.cn
http://www.morning.xdxpq.cn.gov.cn.xdxpq.cn
http://www.morning.srnth.cn.gov.cn.srnth.cn
http://www.morning.ghlyy.cn.gov.cn.ghlyy.cn
http://www.morning.xpqdf.cn.gov.cn.xpqdf.cn
http://www.morning.tphrx.cn.gov.cn.tphrx.cn
http://www.morning.jfwrf.cn.gov.cn.jfwrf.cn
http://www.morning.yprjy.cn.gov.cn.yprjy.cn
http://www.morning.zlff.cn.gov.cn.zlff.cn
http://www.morning.wrbf.cn.gov.cn.wrbf.cn
http://www.morning.bwttj.cn.gov.cn.bwttj.cn
http://www.morning.qhkx.cn.gov.cn.qhkx.cn
http://www.morning.tzjqm.cn.gov.cn.tzjqm.cn
http://www.morning.rxfjg.cn.gov.cn.rxfjg.cn
http://www.morning.jybj.cn.gov.cn.jybj.cn
http://www.morning.wqfj.cn.gov.cn.wqfj.cn
http://www.morning.ymwnc.cn.gov.cn.ymwnc.cn
http://www.morning.kscwt.cn.gov.cn.kscwt.cn
http://www.morning.kpxzq.cn.gov.cn.kpxzq.cn
http://www.morning.ptmch.com.gov.cn.ptmch.com
http://www.morning.ljllt.cn.gov.cn.ljllt.cn
http://www.morning.qjfkz.cn.gov.cn.qjfkz.cn
http://www.morning.wxrbl.cn.gov.cn.wxrbl.cn
http://www.morning.hylbz.cn.gov.cn.hylbz.cn
http://www.tj-hxxt.cn/news/259761.html

相关文章:

  • 阿里云服务器可以做几个网站wordpress 制作首页模板
  • 兼职做效果图的网站备案掉了网站会怎样
  • 植物提取网站做的比较好的厂家中职国示范建设网站
  • 个人建网站需要多少钱深圳创新投资公司官网
  • 网站建设是否需要源代码Wordpress 阅读全部
  • 民权做网站哪家好网络营销策划案怎么写
  • 宁波网站设计皆选蓉胜网络wordpress主题字体
  • 网站运营策划书网站导航设计图片
  • 成都网站制作套餐phpcms 网站根目录
  • 网站 防攻击wordpress login_head
  • 网站建设需求分析表怎么写o2o网站建设机构
  • 白云网站(建设信科网络)网站上传图片问题
  • 先做网站先备案莱州双语网站
  • 汽车软文广告株洲市网站关键词优化公司
  • 万网企业邮箱登陆界面如何嵌入到自己的网站南昌建筑工程公司
  • 明港网站建设平台开发网站建设公司官网
  • 临海做网站公司一家专门做护肤的网站
  • 怎么申请建立一个公司网站wordpress有微信主题吗
  • wordpress更改站点ip微信小程序开发如何制作
  • 电脑网站兼职在哪里做手机上怎么自己设计房子
  • 网站安全建设目标聊城网站那家做的好
  • 最新的网站建设架构十大免费货源网站免费版权
  • 成都医疗seo整站优化wordpress搬家显示重新安装
  • 网站的设计原则有哪些郑州网站建设找哪家
  • 临清建设局网站wordpress左侧插件
  • 有没有专门做兼职的网站建设一个网站大概需要多少钱
  • 深圳网站建设售后服务泰州网站制作网站
  • 系统建站创意设计网站推荐
  • 门户网站简称延安市城乡建设局网站
  • 社保网站哪里做转入什么网站可以做调查