> For the complete documentation index, see [llms.txt](https://note.niefee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://note.niefee.com/summary-1/12/2015-nian-12-yue-26-ri.md).

# 2015年12月26日

## HTML

* base

`<base>`标签为页面上的所有链接规定默认地址或默认目标。 使浏览器随后将不再使用当前文档的 URL，而使用指定的基本 URL 来解析所有的相对 URL。

```
<html>
<head>
<base href="http://www.w3school.com.cn/i/" />
<base target="_blank" />
</head>
<body>
<img src="eg_smile.gif" /><br />
<p>请注意，我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL，浏览器将在如下地址寻找图片：</p>
<p>"http://www.w3school.com.cn/i/eg_smile.gif"</p>

<br /><br />
<p><a href="http://www.w3school.com.cn">W3School</a></p>
<p>请注意，链接会在新窗口中打开，即使链接中没有 target="_blank" 属性。这是因为 base 元素的 target 属性已经被设置为 "_blank" 了。</p>
</body>
</html>
```

* 文本格式化标签

|     标签    | 描述      | 效果                            |
| :-------: | ------- | ----------------------------- |
|    < b>   | 定义粗体文本。 | **This text is bold**         |
|   < big>  | 定义大号字。  | This text is big              |
|   < em>   | 定义着重文字。 | *This text is emphasized*     |
|    < i>   | 定义斜体字。  | This text is italic           |
|  < small> | 定义小号字。  | This text is small            |
| < strong> | 定义加重语气。 | **This text is strong**       |
|   < sub>  | 定义下标字。  | subscriptThis text contains   |
|   < sup>  | 定义上标字。  | This text containssuperscript |
|   < ins>  | 定义插入字。  | ins                           |
|   < del>  | 定义删除字。  | ~~del~~                       |

* 计算机输出标签

| 标签      | 描述         | 效果                |
| ------- | ---------- | ----------------- |
| < code> | 定义计算机代码。   | `Computer code`   |
| < kbd>  | 定义键盘码。     | Keyboard input    |
| < samp> | 定义计算机代码样本。 | Sample text       |
| < tt>   | 定义打字机代码。   | Teletype text     |
| < var>  | 定义变量。      | Computer variable |
| < pre>  | 定义预格式文本。   |                   |

&#x20;**< pre>**

```
 <pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks
</pre>
```

**效果**

```

Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks
```

> pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。 可以导致段落断开的标签（例如标题、< p> 和 < address> 标签）**绝不能**包含在 < pre> 所定义的块里。尽管有些浏览器会把段落结束标签解释为简单地换行，但是这种行为在所有浏览器上并不都是一样的。

* 面向对象的编程:关于对象的 属性、方法和事件 的理解

把 **属性** 看作是对象的 性质 。 把 **方法** 看作是对象的 动作 。 把 **事件** 看作是对象的 响应 。
