html基础1
- <head>标签
- <title>
- <base/>
- <link/>(rel、href、type)
- <meta/>(http-equiv、name、content)
- <body>标签
- 块级标签 & 内联标签
- 基本标签(<h1>~<h6>、<p>、<b> <strong>、<strike>、<u>、<em> <i>、<sup>、<sub>、<br>、<hr>、<div>、<span>)
- 特殊符号(>、<、 、"、©...)
- <a> 超链接标签(锚标签)(href、target、name)
- <img> 图形标签(src、title、alt、width、height、align)
- 列表标签(<ul>、<ol>、<li>、<dl>、<dt>、<dd>)
- <table> 表格标签(<table> 、<caption> 、<tr>、<th>、<td>、<thead>、<tbody>、rowspan、colspan)
- <from> 表单标签(action、method、enctype、<input>、<textarea>、<select>、<label>、<fieldset>)
- 框架
- <frameset>
- <iframe>
-
<title>
1<
title
>Title</
title
>
<base/>
标签为页面上的所有链接规定默认地址或默认目标。
<link/>
引用外部文档,常见于引用外部样式。重要属性有三个:rel、href、type。
rel 规定文档与被链接文档之间的关系。
- rel="dns-prefetch" 预先解析缓存文档中使用的域名,目的是为了提高网页访问速度。使用场景:在一个网页频繁使用其他域名资源时。
- rel="shortcut icon"或rel="icon" 在收藏和标题栏上用于显示的图标。示例:<link rel="icon" href="http://images.cnblogs.com/cnblogs_com/suoning/845162/o_s.png">。注意:IE浏览器只支持ico格式,为了兼容IE,图片文件采用ico格式。
- rel="stylesheet" 引用外部样式表。
- rel="nofollow" 用于指示搜索引擎不要追踪(爬虫抓取),减少垃圾链接。用于<a>标签,使用场景:网页不被信任或是不希望呗搜索引擎录入的网站。
href 资源的路径(相对路径/绝对路径)。
type 规定被连接文档的MIME类型,用于明确文件的打开方式。例如:.ico文件 image/x-icon。
<meta/>
定义关于HTML文档的元数据。 重要的属性有三个:http-equiv、name、content
http-equiv 把content属性值关联到http头部。
- Content-Type(浏览器接受的文档类型,一般是text/html)
- refresh(网页刷新,以秒为单位)
- expires(设定网页到期时间,一旦过期,必须到服务器上重传)
1234<
meta
http-equiv="Content-Type" content="text/html ;charset=UTF-8"/>
<
meta
http-equiv="Refresh" content="2">
<
meta
http-equiv="Refresh" content="2;URL=https://www.baidu.com">
<
meta
http-equiv="expires" content="6 Jun 2016"/>
name 把content属性关联到一个名称。
- keywords(搜索关键字,用于搜索引擎抓取信息的显示)
- description(搜索到网站后显示的网页内容简描述)
- author(站点制作者信息)
- generator(用以说明生成工具)
- name也可以根据特定的功能自定义,在新浪网中有使用360认证和搜狐认证(<meta name="360-site-verification"content="63349**********"/>、<meta name="sogou_site_verification"content="BVI*******"/>)。
1234<
meta
name="keywords" content="搜索关键字">
<
meta
name="description" content="简要描述">
<
meta
name="author" content="http://cnblogs.com/suoning">
<
meta
name="generator" content="用以说明生成工具">
content 定义与http-equiv或name属性相关的元信息,是必要的属性。