HTML 中块元素的使用与格式化
在 HTML 文档的构建中,块元素起着至关重要的作用,它们就像建筑的基石,构建起网页的基本结构。下面将详细介绍 HTML 中一些常见块元素的使用方法和相关技巧。
1. 换行与段落
HTML 对代码中的空白字符处理比较“宽容”,浏览器会遵循 HTML 规则,将代码中的空白字符进行压缩,只通过标签来插入格式。例如以下代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Excerpt From Hamlet</title>
</head>
<body>
Scene I. Elsinore. A platform before the Castle.
[Francisco at his post. Enter to him Bernardo.]
Ber.
Who’s there?
Fran.
Nay, answer me: stand, and unfold yourself.
Ber.
Long live the king!
Fran.
Bernardo?
Ber.
He.
Fran.
You come most carefully upon your hour.
Ber.
‘Tis now struck twelve. Get thee to bed, Francisco.
Fran.
For this relief much tha
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



