
使用 标签在文档中添加一个部分。 HTML 标签用于定义文档的一部分。使用 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;
}

