Home  >  Article  >  Web Front-end  >  HTML__inline elements vs. block elements

HTML__inline elements vs. block elements

高洛峰
高洛峰Original
2017-02-18 14:33:471793browse

In the HTML4.0 era, HTML element types are divided into inline elements and block-level elements.

First, inline elements

The inline element is a basic element based on the semantic level, which generally can only accommodate text and other inline elements.

The following elements are all inline elements:

b(字体加粗) 
kbd(代表文字从键盘录入) 
q(引用文字) 
big(字号比周围字体大一号) 
strong(重要文字,在盲文阅读设备中,会重点读,界面显示效果为加粗) 
script(脚本)
i(文字斜体)
samp(极少用,连字符)
span(用于组合其他内联元素)
small(比周围字体小一号)
time(html5中的新标签,用于标记时间,目前浏览器都不支持)
sub(定义下标文本,显示为其他文字高度一半)
tt(告诉浏览器,字体必须等宽)
var(告诉浏览器,这是变量)
sup(定义上标文本)
abbr(代表是长单词或短语的缩写)
a(超链接)
button(按钮)
acronym(缩写,HTML5中已弃用,请使用abbr替代)
bdo(可定义文本方向)
input(基本输入框)
cite(定义引用的文档)
br(换行符)
label(文本标签,但是有个牛逼的特性,利用for属性,可以绑定其他元素,使得鼠标点击该标签时,被绑定元素获得焦点)
code(定义源码文本)
img(图片文本)
select(下拉选择组件)
dfn(definition and usage,定义一个概念的定义处,一般的在一个文档中最先出现的地方)
map(定义一个客户端的图形映射)
textarea(文本输入框)
em(定义需要强调的文字,一般用斜体表示)
object(定义一个嵌入的对象)

The second block element

Block elements are generally container elements for other elements, used for layout, and need to be placed in the body inside the label.

The following are block elements:

address(定义了文章拥有者的联系信息)
figure(定义独立的流内容,例如图片、视频)
noscript(定义如果浏览器不支持脚本语言时显示的内容)
article(定义文章内容)
footer(定义文档底部)
ol(ordered list)
aside(aside content,可用做侧栏)
form(input form)
output(定义form的输出)
blockquote(定义引用于别处的内容)
h1,h2,h3,h4,h5,h6(标题)
p(段落)
canvas(画布)
header(页眉)
pre(preformatted text,定义预格式化内容)
dd(definition description)
hgroup(对标题进行组合)
section(定义页眉的区域)
p(文档分割)
hr(定义分割线)
table(表格)
dl(definistion list)
li(list item)
tfoot(table footer)
fieldset(field set label)
main(contains the central content to this document)
ul(unordered list)
figcaption(figure caption)
nav(contains navigation links)
video(video player)

The difference between third inline and block elements

  • By default, block elements will start a new line, and Inline elements will be inline

  • Generally, the internal structure of block elements is more complex than that of inline elements, and block elements may contain inline elements and other block elements.


For more HTML__ inline elements and block elements related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn