html初步之二

本文深入解析HTML中的基本标签,包括段落、标题、换行与水平线的使用方法及示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        html的基本标签有段落、标题、换行、水平分割线、注释,现一一给出实例。

        段落:用<p>和</p>定义。

<html>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>Paragraph elements are defined by the p tag.</p>
</body>
</html>
        标题:用<h>和</h>定义。在h后面加上阿拉伯数字可以表示标题显示的大小,比如<h1>、<h2>...另外标题位置属性是align,居中值是"center"。

<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h1>This is a heading</h1>
<body>
<h1 align="center">This is heading 1</h1>
<p>The heading above is aligned to the center of this page.</p>
</body>
        换行:用单标签<br>定义。可以用它来插入空行。在<br>左右不管有多少个空白符,都将被滤掉。

This        <br>is a para<br>        graph with line breaks
        水平线:用单标签<hr>定义。用于分隔上下文内容。

<html>
<body>
<p>The hr tag defines a horizontal rule:</p>
<hr>
<p>This is a paragraph</p>
<hr>
<p>This is a paragraph</p>
</body>
</html>
        注释:在左角括号后跟上一个感叹号定义,即<!>,感叹号后面跟的内容就作为注释。这部分会被浏览器自动忽略,它的作用是解释代码。

<!This is a comment>
This is a comment!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值