您的位置:首页 > 其它

文档元数据base link meta元素

2015-08-06 15:38 288 查看
base元素:

base元素用于指定文档的默认基地址以及链接的打开方式

例子:

<head>

    <base href="/new/addr/" />

    <base target="_blank" />

</head>

<body>

    <!--浏览器会请求/new/addr/1.gif这个文件-->

    <img src="1.gif" />

    <!--页面将会在新窗口打开-->

    <a href="index.html"></a>

</body>

link元素:

1、定义css样式表

   <link rel="stylesheet" type="text/css" href="style.css" />

2、定义网页的图标,可使用H5新属性sizes规定尺寸

   <link rel="icon" href="favicon.ico" type="image/x-icon" sizes="16*16" />

3、苹果ios系统添加网页到桌面上,图标设置

   <link rel="apple-touch-icon" href="..png" sizes="57*57" />

   <link rel="apple-touch-icon-precomposed" href="..png" sizes="72*72" />

   注释:因为苹果有不同的分辨率,所以设置不同尺寸的icon

   apple-touch-icon和apple-touch-icon-precomposed区别:ios会默认给你的图标添加一些样式,如果你需要保留你图标的原始样式,使用apple-touch-icon-precomposed

4、ios应用添加启动画面(单击图标后在页面加载完成之前显示的广告图)

   <link rel="apple-touch-startup-image" media="screen and (orientation:portrait)" href="/apple_startup.png" />

   <link rel="apple-touch-startup-image" media="screen and (orientation:landscape)" href="/apple_startup1.png" />

   注释:portrait表示竖屏,landscape表示横屏

meta元素:

<meta http-equiv="refresh" content="5" />

注释:5秒后刷新页面

<meta http-equiv="set-cookie" content="key=x;path=y" />

注释:设置cookie

另:author、description、keywords(英文逗号分隔)描述在SEO中发挥着重要的作用

ios6之后的设备使用Safari访问时弹出下载应用的提示:

<meta name="apple-itunes-app" content="app-id=123456">

使页面不能手动缩放:

<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1.0,maximum-scale=1.0" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: