HTML常见元素

一、HTML常见元素

 meta  title  link  style  script  base
div/section/article/aside/header/footer
p
span/strong/em
table/thead/tbody/tr/td
ul/ol/li/dl/dt/dd
a
form/input/select/textarea/button
详解:
<meta charset="UTF-8">

charset 表示页面字符集编码

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

控制显示区域各种属性

  • width:viewport的宽度
  • height:viewport的高度
  • initial-scale:初始的缩放比例
  • minimum-scale:允许用户缩放到的最小比例
  • maximum-scale:允许用户缩放到的最大比例
  • user-scalable:用户是否可以手动缩放
<base href="/">

制定基础路径,指定后,所有的链接都会以此路径作为基准进行计算

二、HTML重要属性

a[href, target]
img[src, alt]
table td[colspan, rowspan]
form[target, method, enctype]
input[type, value]
button[type]
select>option[value]
label[for]
  1. enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码:
  • application/x-www-form-urlencoded 在发送前编码所有字符(默认)
  • multipart/form-data 不对字符编码。在使用包含文件上传控件的表单时,必须使用该值。
  • text/plain 空格转换为 “+” 加号,但不对特殊字符编码。
  1. input框name值相同时,可以做单选框
<p>
	<input type="radio" name="radio1" id="radio1-1">
	<label for="radio1-1">选项一</label>
	<input type="radio" name="radio1" id="radio1-2">
	<label for="radio1-2">选项二</label>
</p>

  1. button的type属性
<p>
    <button type="button">普通按钮</button>
    <button type="submit">提交按钮一<button> //只在form表单中有意义
	<input type="submit" value="提交按钮二">
	<button type="reset">重置按钮</button> //只在form表单中有意义
</p>

语义化


版权声明:本文为weixin_42084225原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。