资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

html5制作邀请函的方法是什么-创新互联

小编给大家分享一下html5制作邀请函的方法是什么,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

成都创新互联专注于门源企业网站建设,自适应网站建设,商城网站定制开发。门源网站建设公司,为门源等地区提供建站服务。全流程按需网站设计,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

目的:制作这个简易的邀请函,只是为了让新手入门Web开发。

在制作页面之前,我们先来看看整个邀请函的整体面貌。

html5制作邀请函的方法是什么

一、首先编写HTML代码




   
   邀请函 
  
 
  
    

hello world

    

欢迎来到虚拟世界,在这里发挥你的想象力,探索无限的可能。

    点击进入   

说明:

:这形如一个对文档的声明。

标签:代表了对html的开始,代表着html的结束。

标签:它包含了对html5页面各种属性,配置信息的描述。因此在某种程度上可以视为一张“身份证”。

标签:使用标签的charset来加以设置,将其字符编码指定为UTF-8;UTF-8这是一种通用编码形式,又被称为“万国码”。

标签:即页面的标题,显示在浏览器器的菜单栏上。</p><p><body> 标签:包含了所有要呈现给浏览者的内容信息。</p><p><div>  标签:这是一个常见的块级元素,相当于一个容器,它经常用来div+css布局。在这里我们用他来调整页面的位置。</p><p><h2>   标签:这是一个标题,他有1~6六个级别。</p><p><p>    标签:这表示一个段落。</p><p><a>    标签:这是一个链接。</p><p><strong>二、页面的美化:CSS</strong></p><p>1、给页面添加背景图片:</p><pre>html,body{ height: 100%; }body { background: url(images/1.jpg) center center; background-size: cover; }</pre><p>我们在给网页添加背景图片的时候,我们选取的背景图片可能像素比较大,不适应我们的浏览器窗口;所以我们给body的background属性在横向和纵向两个方向上居中(center),由于浏览器默认是没有给予body高度属性的,所以要给body和body的父级(html)设置height:100%属性。在body设置属性background-size:cover;实现背景图片自适应充满全屏。</p><p>2、为网页添加字体的样式</p><pre>html,body{ height: 100%; font-family: sans-serif; color: #801449; }</pre><p>font-family:属性可以改变字体。</p><p>color:可以改变字体的颜色,由于css具有继承机制,所以后续的元素都有这一属性。</p><p>3、调整邀请函内容区域位置。</p><pre>body { background: url(images/1.jpg) center center; background-size: cover; margin: 0; padding: 0; position: relative; }#container { width: 100%; text-align: center; position: absolute; top: 50%; transform: translateY(-50%); }</pre><p>首先,我们使用margin: 0;padding: 0;这是一个很常见的作法,能够清楚浏览器对页面元素预设的一些默认边距值,使得css自主控制更加精确。</p><p>这里我们使用id选择器(#+id名),我们设置其宽度100%;利用text-ailgn:center,让其文本水平居中。</p><p>那么如何实现竖直剧中呢? 这里就用到了定位:我们要控制container的top属性,这要建立在绝对定位的前提下,而要使得container绝对定位,就要使他的父级(body)设置为相对  定位。 之后我们利用属性,让top距顶50%。</p><p>现在还没有结束,我们可以利用html5的transform属性,设置translateY(-50%);即向上移动其高度的一半。</p><p>这样整个container将会显示在页面的正中央。</p><p>4、为其内容标签设置一些文字字体与字号。</p><pre>h2 { font-size: 54px; text-transform: uppercase; margin-bottom: 20px; }p { font-size: 21px; margin-bottom: 40px; }a { font-size: 18px; color: #8f3c3c; }</pre><p>说明:</p><p>font-size :设置字体的大小。</p><p>text-transform:uppercase :是文本都转化为大写字母。</p><p>margin-bottom:20px  :这里牵扯到盒模型,其意思是下边框有20px的宽度。</p><p>5、制作邀请函按钮。</p><pre>a { font-size: 18px; color: #8f3c3c; border: 1px solid #c66c6c; border-radius: 3px; padding: 10px 100px; text-decoration: none; }</pre><p>border:为其设置边框,该属性的三个参数分别代表了边框宽1px,实线,颜色。</p><p>border-radius: 为其边框设置了3px的圆角。</p><p>padding:上下内边距为10px;左右内边距为100px。</p><p>text-decoration:none : 这样可以去掉链接的下划线。</p><p><strong>整体css文件:<em></em></strong></p><pre>html,body{ height: 100%; font-family: sans-serif; color: #801449; } body { background: url(images/1.jpg) center center; background-size: cover; margin: 0; padding: 0; position: relative; } #container { width: 100%; text-align: center; position: absolute; top: 50%; transform: translateY(-50%); } h2 { font-size: 54px; text-transform: uppercase; margin-bottom: 20px; } p { font-size: 21px; margin-bottom: 40px; } a { font-size: 18px; color: #8f3c3c; border: 1px solid #c66c6c; border-radius: 3px; padding: 10px 100px; text-decoration: none; }</pre><p><strong>三、为页面创建交互</strong></p><pre>var btn = document.getElementById('button'); btn.onclick = function(e) { //preventDefault() 可以阻止单机链接后浏览器默认的URL跳转。 e.preventDefault(); btn.innerHTML = "正在进入..." btn.style.border = "0"; }</pre><p>首先我们为<a>链接添加id为button。</p><p>利用document.getElementById(id名)来获取a链接,并将其赋给变量btn。</p><p>然后为btn添加单机属性调用执行函数。</p><pre>e.preventDefault(); //将阻止其默认的链接跳转。 btn.innerHTML = "正在进入..." //改变文本内容。 btn.style.border = "0";</pre><p>看完了这篇文章,相信你对html5制作邀请函的方法是什么有了一定的了解,想了解更多相关知识,欢迎关注创新互联网站制作公司行业资讯频道,感谢各位的阅读!</p> <br> 网页标题:html5制作邀请函的方法是什么-创新互联 <br> URL分享:<a href="http://cdkjz.cn/article/dhsdoo.html">http://cdkjz.cn/article/dhsdoo.html</a> </div> <div class="g-return-wrapper clearfix"> <a href="http://www.cdkjz.cn/" class="home">返回首页</a> <a href="http://www.cdkjz.cn/news/" class="column">了解更多建站资讯</a> </div> </div> </div> <div class="full-related-news"> <h3 class="related-title">相关资讯</h3> <div class="related-news weblg"> <ul class="clearfix"> <li> <a href="/article/gcpidc.html"> <h2 class="title">怎么在jQuery中使用map函数</h2> </a> </li><li> <a href="/article/gcpijg.html"> <h2 class="title">jQuery怎么实现拖拽排序效果</h2> </a> </li><li> <a href="/article/gcpigs.html"> <h2 class="title">js实现select下拉框选择的示例介绍</h2> </a> </li><li> <a href="/article/gcpish.html"> <h2 class="title">如何在Ubuntu18.04/LinuxMint19中安装Wine4</h2> </a> </li><li> <a href="/article/gcpiij.html"> <h2 class="title">python注释是否参与编码</h2> </a> </li><li> <a href="/article/gcpijc.html"> <h2 class="title">python中遍历文件夹并统计所有文件大小</h2> </a> </li><li> <a href="/article/gcpipd.html"> <h2 class="title">php页面传参给shell脚本</h2> </a> </li><li> <a href="/article/gcpisc.html"> <h2 class="title">使用函数计算三步实现深度学习AI推理在线服务</h2> </a> </li> </ul> </div> </div> <div class="full-icontact-cover m-ft-contact"> <div class="weblg"> <div class="clearfix content"> <div class="motto"> 多年建站经验 </div> <div class="info"> <h3>多一份参考,总有益处</h3> <h2> 联系快上网,免费获得专属《策划方案》及报价</h2> <div class="msg"> <p>咨询相关问题或预约面谈,可以通过以下方式与我们联系</p> <h4> 大客户专线   成都:<a href="tel:+13518219792" rel="nofollow">13518219792</a>   座机:<a href="tel:02886922220" rel="nofollow">028-86922220</a> </h4> </div> </div> </div> <div class="btns clearfix"> <a href="https://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes" target="_blank" rel="nofollow" class="oline">在线咨询</a> <a href="javascript:;" class="edit" rel="nofollow">提交需求</a> </div> </div> </div> <div class="footer-content"> <div class="weblg clearfix"> <div class="friend-links"> <h6 class="clearfix"> <span class="tilte">友情链接</span> <a class="exchagne" href="http://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes">交换友情链接</a> </h6> <div class="link-list clearfix"> <div class="link-slider"> <a href="http://www.czyouth.cn/" title="混凝土搅拌车" target="_blank">混凝土搅拌车</a><a href="https://www.xwcx.net/" title="成都机柜租用" target="_blank">成都机柜租用</a><a href="https://www.cdcxhl.com/ruanwen/yingxiao" title="软文发布平台" target="_blank">软文发布平台</a><a href="http://chengdu.cdcxhl.com/xcx/" title="成都微信小程序开发" target="_blank">成都微信小程序开发</a><a href="https://www.cdcxhl.com/sosuo.html" title="关键词优化排名" target="_blank">关键词优化排名</a><a href="https://www.cdxwcx.com/wangzhan/dingzhi.html" title="成都定制网站" target="_blank">成都定制网站</a><a href="https://www.cdxwcx.com/" title="成都网站建设公司" target="_blank">成都网站建设公司</a><a href="http://www.scghjhjc.cn/" title="四川广汉锦华" target="_blank">四川广汉锦华</a><a href="http://www.cqhuaxiang.cn/" title="重庆花箱" target="_blank">重庆花箱</a><a href="https://www.cdcxhl.com/waimao.html" title="外贸网站建设" target="_blank">外贸网站建设</a> </div> </div> </div> </div> <div class="full-foot-bottom"> <div class="weblg clearfix"> <p>成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询<a href="tel:028-86922220">028-86922220</a></p> <p> 成都快上网科技有限公司-四川网站建设设计公司 | <a href="http://www.miitbeian.gov.cn/" target="_blank" rel="nofollow">蜀ICP备19037934号</a> Copyright 2020,ALL Rights Reserved cdkjz.cn | <a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a> | © Copyright 2020版权所有.</p> <p>专家团队为您提供<a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a>,<a href="http://www.cdkjz.cn/" target="_blank">成都网站设计</a>,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | <a href="###">网站建设地图</a></p> </div> </div> </div> <script type="text/javascript" src="../js/idangerous.swiper.min.js"></script> <script type="text/javascript" src="../js/wow.min.js"></script> <script type="text/javascript" src="../js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="../js/jquery.placeholder.min.js"></script> <script type="text/javascript" src="../js/layout.js"></script> </body> </html> <script> $(".singlepage img").each(function(){ var src = $(this).attr("src"); //获取图片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //绝对路径 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>