HTML Blocks

来源:互联网 发布:淘宝html5框架 编辑:程序博客网 时间:2024/06/06 13:07

Block Elements

Block level elements normally start (and end) with a new line when displayed in a browser.

块级元素通常(以新的一行开始/结束)换行在浏览器中显示。

Examples: <h1>, <p>, <ul>, <table>, <li>


<div> Element

该元素是块级元素,可以为其他HTML块级元素定义一个容器。

Another common use of the <div> element, is for document layout. 该元素也是替代了原先使用table来实现页面布局

The purpose of the <table> element is to display tabular data.

因此W3C不建议使用table来实现网页布局(layout)


Inline Elements

Inline elements are normally displayed without starting a new line.

行内级元素通常不换行显示。

Examples: <b>, <td>, <a>, <img>


<span> Element

该元素是一个行内级元素,可以用来作为文本的容器。

The <span> tag provides a way to add a hook 挂钩 to a part of a text or a part of a document.

Tip: When a text is hooked in a <span> element, you can style it with CSS, or manipulate it with JavaScript.

当一段文本在<span>元素中,可以对它进行CSS个性化,或用JS对其进行操作。


0 0