lt;form></form>标记新增属性
required 规定必需在提交之前填写输入字段。
<form name="frm">
姓名:<input type="text" name="username" required="required"></br>
<input type="submit" name="submit" value="提交">
</form>
placeholder 默认显示内容
实例:带有 placeholder 文本的搜索字段:
<form action="demo_form.asp" method="get">
<input type="search" name="user_search" placeholder="请输入默认值" />
<input type="submit" />
</form>
autocomplete 用来设置input组件是否使用自动完成功能,HTML5新增的属性值有on(使用)或off(不使用)两种。
input的属性autocomplete默认为on,其含义代表是否让浏览器自动记录之前输入的值,很多时候,
需要对客户的资料进行保密,防止浏览器软件或者恶意插件获取到,可以在input中加入autocomplete="off" 来关闭记录
系统需要保密的情况下可以使用此参数,该属性也可作用于表单元素
实例:
<form action="demo_form.asp" method="get" autocomplete="on">
First name:<input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
E-mail: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form>
novalidate 用来设置是否在发送表单时验证表单,如需要验证则填入novalidate即可。
novalidate也是HTML5新增的属性,IE并不支持novalidate属性
HTML5新的input类型(目前IE都不支持,Opera和Chrome对新的输入类型的支持最好,即使不被支持,仍然可以显示为常规的文本域。)
input类型 - email
email类型用于应该包含 e-mail 地址的输入域。
在提交表单时,会自动验证 email 域的值。
E-mail: <input type="email" name="user_email" />
input类型 - url
url类型用于应该包含 URL 地址的输入域。
在提交表单时,会自动验证 url 域的值。
Homepage: <input type="url" name="user_url" />
input类型 - number
number类型用于应该包含数值的输入域。
您还能够设定对所接受的数字的限定:
max number 规定允许的最大值
min number 规定允许的最小值
step number 规定合法的数字间隔(如果 step="3",则合法的数是 -3,0,3,6 等)
value number 规定默认值
Points: <input type="number" name="points" min="1" max="10" />
input类型 - range
range类型用于应该包含一定范围内数字值的输入域。
range类型显示为滑动条。
您还能够设定对所接受的数字的限定:
max number 规定允许的最大值
min number 规定允许的最小值
step number 规定合法的数字间隔(如果 step="3",则合法的数是 -3,0,3,6 等)
value number 规定默认值
<input type="range" name="points" min="1" max="10" />
input类型 - Date Pickers(日期选择器)
HTML5拥有多个可供选取日期和时间的新输入类型:
date - 选取日、月、年
month - 选取月、年
week - 选取周和年
time - 选取时间(小时和分钟)
datetime - 选取时间、日、月、年(UTC 时间)
datetime-local - 选取时间、日、月、年(本地时间)
Date: <input type="date" name="user_date" />
input类型 - search
search类型用于搜索域,比如站点搜索或 Google 搜索。
search域显示为常规的文本域。
Search: <input type="search" name="user_color" />
input类型 - color
color输入类型用于规定颜色。
该输入类型允许您从拾色器中选取颜色:
Color: <input type="color" name="user_color" />
HTML5的新的表单元素:(目前IE都不支持)
datalist元素
datalist元素规定输入域的选项列表,功能类似于自造词列表。
列表是通过datalist内的option元素创建的。
如需把datalist绑定到输入域,请用输入域的 list 属性引用 datalist 的 id:
实例1:
<input list="browsers"/>
<datalist id="browsers">
<option value="Internet Explorer"></option>
<option value="Firefox"></option>
<option value="Chrome"></option>
<option value="Opera"></option>
<option value="Safari"></option>
</datalist>
实例2:
Webpage: <input type="url" list="url_list" name="link" /> <!--对输入框进行限制-->
<datalist id="url_list">
<option label="W3School" value="http://www.W3School.com.cn" />
<option label="Google" value="http://www.google.com" />
<option label="Microsoft" value="http://www.microsoft.com" />
</datalist>
提示:option元素永远都要设置 value 属性。
keygen元素
keygen元素的作用是提供一种验证用户的可靠方法。
keygen元素是密钥对生成器(key-pair generator)。当提交表单时,会生成两个键,一个是私钥,一个公钥。
私钥(private key)存储于客户端,公钥(public key)则被发送到服务器。公钥可用于之后验证用户的客户端证书(client certificate)。
目前,浏览器对此元素的糟糕的支持度不足以使其成为一种有用的安全标准。
实例
<form action="demo_form.asp" method="get">
Username: <input type="text" name="usr_name" />
Encryption: <keygen name="security" />
<input type="submit" />
</form>
output元素
output元素用于不同类型的输出,比如计算或脚本输出:
实例
<output id="result" onforminput="resCalc()"></output>
表单元素新增的属性值
文本框text
autofocus属性 自动获得焦点,也就是指加载网页之后,自动将光标(插入点)移到此文本框内。
多行文本框textarea
warp属性在HTML5属性值有:
soft 当在表单中提交时,textarea 中的文本不换行。默认值。
hard 当在表单中提交时,textarea 中的文本换行(包含换行符)。当使用 "hard" 时,必须规定 cols 属性。
wrap属性在HTML4属性值有:
off(也可写成wrap):不换行,当输入的内容超出文本区域右边界时,文本将向左滚动,并显示滚动条。
如果希望换行,必须手动输入回车键才能将插入点移到下一行;
virtual:文本能够自动换行,当数据提交到服务器被处理时,换行符不会随输入文本一同提交到服务器;(默认值)
physical:文本能够自动换行,当数据提交到服务器被处理时,换行符将会随输入的文本一同被提交到服务器进行处理;
表单分组fieldset
fieldset元素可将表单内的相关元素分组。
HTML5新增的属性
disabled disabled 规定应该禁用fieldset。
form form_id 规定fieldset所属的一个或多个表单。
name value 规定fieldset的名称。
实例
组合表单中的相关元素:
<form>
<fieldset disabled="disabled" form="formid" name="person">
<legend>health information</legend>
height: <input type="text" />
weight: <input type="text" />
</fieldset>
</form>
legend元素为fieldset元素定义标题(caption)。
tml5中常用的结构标签
article 文章
header 头部
nav 导航
section 区域
aside 侧边栏
hgroup 区块的相关信息
figure 定义一组内容及标题
figcaption 定义figure元素的标题
footer 底部
dialog 对话框
使用习惯:
header/section/footer > aside/article/figure/hgroup/nav > div
embed可插入flash文件,但flash已经逐渐被淘汰,不建议使用
meter状态标签,可以定义电压
optimum是标准状态
low与high之间呈现绿色,其余呈现黄色
<meter value=”220” min=”20” max=”380” low=”200” high=”240” optimum=”220”></meter>
自动计算百分比
<meter value="0.75">75%</meter>
有步长的进度条
<progress value="30" max="100"></progress>
不断加载的进度条
<progress max="100"></progress>
datalist为input定义下拉列表
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<input placeholder="请选择手机品牌" list="phoneList">
<datalist id="phoneList">
<option value="iphone">iphone</option>
<option value="samsung">samsung</option>
<option value="huawei">huawei</option>
<option value="oppo">oppo</option>
<option value="htc">htc</option>
</datalist>
</body>
</html>
details定义元素的详细内容,配合summary
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<details>
<summary>HTML5</summary>
<p>HTML5是构建Web内容的一种语言描述方式。HTML5是互联网的下一代标准,是构建以及呈现互联网内容的一种语言方式.被认为是互联网的核心技术之一。HTML产生于1990年,1997年HTML4成为互联网标准,并广泛应用于互联网应用的开发。
HTML5是Web中核心语言HTML的规范,用户使用任何手段进行网页浏览时看到的内容原本都是HTML格式的,在浏览器中通过一些技术处理将其转换成为了可识别的信息。HTML5在从前HTML4.01的基础上进行了一定的改进,虽然技术人员在开发过程中可能不会将这些新技术投入应用,但是对于该种技术的新特性,网站开发技术人员是必须要有所了解的。 [1-2] </p>
</details>
</body>
</html>
ruby和rt进行拼音的注释
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
我们来<ruby>夼<rt>kuang</rt></ruby>一个话题
</body>
</html>
兼容浏览器的写法:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
我们来<ruby>夼<rp>(</rp><rt>Kuang</rt><rp>)</rp></ruby>一个话题
</body>
</html>
mark黄色选中效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<p>妈妈叫我回家的时候顺路买一盒<mark>牛奶</mark>,需要很新鲜的那种。</p>
</body>
</html>
output表单计算
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<form oninput="sum.value=parseInt(num1.value)*parseInt(num2.value)">
<input type="number" id="num1">*
<input type="number" id="num2">=
<output name="sum" for="num1 num2"></output>
</form>
</body>
</html>
date pickers在移动端效果比较好
week兼容性不好
datetime兼容性不好,推荐用datetime-local
time用来设置时间(小时和分钟);
month用来设置年和月;
date用来设置年月日;
datetime用来设置年月日和时间;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
email:<input type="email" name="email"><br>
url:<input type="url" name="url"><br>
tel:<input type="tel" name="tel"><br>
number:<input type="number" name="number"><br>
date:<input type="date" name="date"><br>
month:<input type="month" name="month"><br>
week:<input type="week" name="week"><br>
time:<input type="time" name="time"><br>
datetime:<input type="datetime" name="datetime"><br>
datetime-local:<input type="datetime-local" name="datetime-local"><br>
range:<input type="range" name="range" min="1" max="10"><br>
search:<input type="search" name="search"><br>
color:<input type="color" name="color"><br>
</body>
</html>
autocomplete属性规定form或input域拥有自动完成功能,该属性适用于<form>标签和<input>标签
autofocus自动获取焦点
multiple多选,适用于email和file,email中不同邮箱用,隔开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<form action="lesson2_1 autocomplete.html" autocomplete="on">
<input type="text" name="text" autofocus="autofocus" placeholder="您好,请在这里输入您的用户名!"><br>
<input type="email" name="email" autocomplete="off" multiple="multiple"><br>
<input type="file" name="file" multiple="multiple"><br>
<input type="submit">
</form>
</body>
</html>
<link>标签中,sizes属性可以规定被链接资源的尺寸的大小
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
<link rel="icon" href="icon.gif" type="image/gif" sizes="16x16">
<base href="http://localhost" target="_blank">
</head>
<body>
</body>
</html>
script:
defer 页面已完成加载后再执行脚本
async 一旦脚本可用,则异步执行
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
<script async="async" type="text/javascript" src="async.js"></script>
<script defer="defer" type="text/javascript" src="defer.js"></script>
</head>
<body>
</body>
</html>
ol有序列表倒序
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ol</title>
</head>
<body>
<ol start="2" reversed="reversed">
<li>Html</li>
<li>Html5</li>
<li>Css</li>
<li>Css3</li>
<li>JavaScript</li>
</ol>
</body>
</html>
html页面布局demo:
demo.html
----------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>html5</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="container">
<a href="index.html"><img src="images/logo.png"></a>
<nav>
<a class="active" href="index.html">Home</a>
<a href="#">Course</a>
<a href="#">Actual</a>
<a href="#">Plan</a>
<a href="#">FAQ</a>
<a href="#">Notes</a>
</nav>
</div>
</header>
<section class="banner">
<ul>
<li class="active"><img src="images/banner/banner1.jpg"></li>
<li class="left"><img src="images/banner/banner3.jpg"></li>
<li class="right"><img src="images/banner/banner2.jpg"></li>
</ul>
</section>
<section class="main">
<aside>
<h1>Recent <samp>Course</samp></h1>
<dl>
<dt>Hyper Text Markup Language</dt>
<dd><img src="images/Course/05_05.png"></dd>
<dd>HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites.</dd>
</dl>
<dl>
<dt>Cascading Style Sheets</dt>
<dd><img src="images/Course/06_04.png"></dd>
<dd>Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents.</dd>
</dl>
<dl>
<dt>JavaScript</dt>
<dd><img src="images/Course/09_07.png"></dd>
<dd>JavaScript is a high-level, dynamic, untyped, and interpreted programming language.</dd>
</dl>
<dl>
<dt>AngularJS</dt>
<dd><img src="images/Course/02_09.png"></dd>
<dd>AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</dd>
</dl>
</aside>
<article>
<h1>Welcome to <samp>Massive Open Online Course!</samp></h1>
<p>We provide the latest knowledge to help you cope with the changing world!</p>
<img src="images/article.jpg">
<p>We hope that all the students who love the Internet can be more convenient access to learning resources, using the Internet thinking to change our learning.</p>
<p>Focus on IT skills education MOOC, consistent with the development trend of the Internet down to earth's MOOC. We are free, we only teach useful, we concentrate on education.</p>
</article>
</section>
<footer>
<div class="container">
<p>Copyright © 2019 test.com All Rights Reserved.</p>
<span>
<img src="images/icon/weichat.png">
<img src="images/icon/sina.png">
<img src="images/icon/qq.png">
</span>
</div>
</footer>
</body>
</html>
style.css
------------------------------------------
/* All tag */
* { font-family: Arial; font-size: 14px; margin: 0; padding: 0; border: none; }
a { text-decoration: none; }
ul { list-style: none; }
/* header */
header { position: relative; height: 80px; background: #000; }
header:after { position: absolute; bottom: 0; left: 0; width: 100%; height: 7px; content: ''; background: #d6d6d6; }
header > .container { position: relative; z-index: 1; width: 1200px; margin: 0 auto; }
header > .container > a { display: block; float: left; margin: 5px 25px; }
header > .container > nav { float: right; }
/* nav */
nav > a { font-size: 24px; line-height: 73px; display: block; float: left; width: 110px; height: 73px; text-align: center; color: #fff; }
nav > a:nth-child(1) { background: #433b90; }
nav > a:nth-child(2) { background: #017fcb; }
nav > a:nth-child(3) { background: #78b917; }
nav > a:nth-child(4) { background: #feb800; }
nav > a:nth-child(5) { background: #f27c01; }
nav > a:nth-child(6) { background: #d40112; }
nav > a:hover,
nav > a.active { padding-bottom: 7px; }
/* banner */
.banner { position: relative; background: #eaeaea; }
.banner:after { position: absolute; bottom: 0; left: 0; width: 100%; height: 6px; content: ''; background: #d6d6d6; }
.banner > ul { position: relative; width: 1490px; height: 538px; margin: 0 auto; padding-top: 10px; }
.banner > ul > li { position: absolute; width: 610px; height: 300px; overflow: hidden; }
.banner > ul > li.active { z-index: 2; top: 37px; right: 0; left: 0; width: 960px; height: 460px; margin: auto; border: 1px solid #fff; box-shadow: 0 30px 140px 22px rgba(0, 0, 0, .35); }
.banner > ul > li.left { z-index: 1; top: 0; bottom: 0; left: 0; margin: auto; box-shadow: 0 3px 7px 0 rgba(0, 0, 0, .35); }
.banner > ul > li.right { z-index: 1; top: 0; right: 0; bottom: 0; margin: auto; box-shadow: 0 3px 7px 0 rgba(0, 0, 0, .35); }
.banner > ul > li > img { position: absolute; left: -30%; height: 100%; }
/* main */
.main { position: relative; width: 1200px; height: 473px; margin: 34px auto 0; }
.main h1 { font-size: 30px; font-weight: lighter; margin-bottom: 23px; }
.main h1 > samp { font-size: 30px; color: #7c7c7c; }
.main > aside { float: left; width: 450px; }
.main > aside > dl { position: relative; display: block; height: 74px; margin-bottom: 17px; }
.main > aside > dl > dt { position: absolute; top: -1px; left: 92px; font-size: 16px; font-weight: bold; line-height: 16px; text-decoration: underline; }
.main > aside > dl > dd:first-of-type { position: absolute; left: 0; }
.main > aside > dl > dd:last-of-type { position: absolute; top: 20px; left: 90px; }
.main > article { float: right; width: 720px; overflow: hidden; }
.main > article > p,
.main > article > img { margin-bottom: 20px; }
/* footer */
footer { position: relative; background: #000; }
footer:before { position: absolute; z-index: -1; top: -6px; left: 0; width: 100%; height: 6px; content: ''; background: #d6d6d6; }
footer > .container { width: 1200px; height: 64px; margin: 0 auto; }
footer > .container > p { line-height: 64px; float: left; color: #fff; }
footer > .container > span { float: right; margin: 14px 40px; }
footer > .container > span > img { margin-left: 4px; opacity: .7; }
footer > .container > span > img:hover { opacity: 1; cursor: pointer; }
html页面布局demo2:
码:https://gitee.com/xproer/up6-vue-cli
1.引入up6组件
2.配置接口地址
接口地址分别对应:文件初始化,文件数据上传,文件进度,文件上传完毕,文件删除,文件夹初始化,文件夹删除,文件列表
参考:http://www.ncmem.com/doc/view.aspx?id=e1f49f3e1d4742e19135e00bd41fa3de
3.定义事件
*请认真填写需求信息,我们会在24小时内与您取得联系。