https://www.w3.org/wiki/HTML/Elements/base

HTML/Elements/base

HTML‎ | Elements
 

<base>

The <base> element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks. The element does not represent any content beyond this information.

Point

  • A base element must have either an href attribute, a target attribute, or both.
  • There must be no more than one base element per document.

HTML Attributes

  • href = valid URL potentially surrounded by spaces
    A base element, if it has an href attribute, must come before any other elements in the tree that have attributes defined as taking URLs, except the html element (its manifest attribute isn't affected by base elements). [Example A]
  • target = valid browsing context name or keyword ( _blank, _self, _parent, or _top)
    The value of the target attribute is used as the default when hyperlinks and forms in the Document cause navigation.

See also global attributes.

Examples

Example A

In this example, a <base> element is used to set the document base URL.
The link in the this example would be a link to "http://www.example.com/news/archives.html" [try it]:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>This is an example for the <base> element</title>
<base href="http://www.example.com/news/index.html">
</head>
<body>
<p>Visit the <a href="archives.html">archives</a>.</p>
</body>
</html>

HTML Reference

The HTML5 specification defines the <base> element in 4.2.3 The base element.

最新文章

  1. ffmpeg编译与移植问题
  2. 如何将C#类库做成COM
  3. JavaWeb:JavaBean基础
  4. leetcode 32. Longest Valid Parentheses
  5. mybatis异常:Improper inline parameter map format. Should be: #{propName,attr1=val1,attr2=val2}问题分析及解决
  6. 2016 ACM/ICPC Asia Regional Dalian Online 1002/HDU 5869
  7. 20141103--SQL主键,外键
  8. Linux与windows文件乱码问题
  9. Linux下GPIO驱动(四) ----gpio_request();gpio_free();
  10. C#获取类中所有方法
  11. HDU 1995
  12. Free Sql Server SMSS format Plugin
  13. [Cocos2d-x]代码段记录
  14. 【个人笔记】《知了堂》express模块
  15. 数据库~dotnetcore连接Mysql插入中文失败
  16. ApplicationListener详解
  17. mysql_day02
  18. idea 添加项目到svn
  19. python中的swapcase
  20. php把时间戳转换成英文格式

热门文章

  1. Flask 吐血400错误
  2. Spring预处理
  3. dex文件格式二
  4. sublime text install packages报错
  5. .NET LINQ查询操作中的类型关系
  6. nginx 反向代理 配置 https 实现http https同时存在
  7. HDU5880 Family View(2016青岛网络赛 AC自动机)
  8. Android ImageView的scaleType属性与adjustViewBounds属性(转)
  9. IBatis.Net使用总结(二)-- IBatis返回DataTable/DataSet(网上例子的集合)
  10. 三言两语之简单上手sass