如何在 HTML 文档中创建章节?
htmlweb developmentfront end technology更新于 2025/8/15 6:04:17
使用 <div> 标签在文档中添加章节。HTML <div> 标签用于定义文档的章节。使用 div 标签,您可以将大量的 HTML 元素组合在一起,并使用 CSS 对其进行格式化。
示例
您可以尝试以下代码来创建章节 −
<!DOCTYPE html> <html> <head> <title>HTML div Tag</title> <link rel = "stylesheet" href = "style2.css"> </head> <body> <div id = "contentinfo"> <p>Welcome to our website. We provide tutorials on various subjects.</p> </div> </body> </html>
以下是 css 文件 style2.css
#contentinfo p {
line-height: 20px;
margin: 30px;
padding-bottom: 20px;
text-align: justify;
width: 140px;
color: red;
}
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

