html标签怎么打「html标签怎么打出来」
HTML(HyperText Markup
(图片来源网络,侵删)
Language,超文本标记语言)是用于创建网页的标准标记语言,HTML
标签是 HTML 语言的核心组成部分,它们用于定义网页的结构和内容,在 HTML
中,标签由尖括号包围,<p>
、<h1>
等,标签可以是成对出现的开始标签和结束标签,也可以是自闭合标签,不需要结束标签。
下面是一些常用的 HTML 标签及其用法:
1. <!DOCTYPE html>
:声明文档类型,告诉浏览器这是一个 HTML5 文档。
<!DOCTYPE html> <html> <head> <title>我的第一个 HTML 页面</title> </head> <body> <h1>欢迎来到我的网站</h1> <p>这是一个简单的 HTML 页面。</p> </body> </html>
2. <html>
:根元素,包含整个 HTML 文档的内容。
3. <head>
:包含文档的元数据,如标题、字符集、样式表和脚本等。
4. <title>
:定义文档的标题,显示在浏览器的标题栏或标签页上。
5. <body>
:包含可见的页面内容,如文本、图片、链接等。
6. <h1>
到 <h6>
:定义不同级别的标题,<h1>
最高级别,<h6>
最低级别。
<h1>一级标题</h1> <h2>二级标题</h2> <h3>三级标题</h3> <h4>四级标题</h4> <h5>五级标题</h5> <h6>六级标题</h6>
7. <p>
:定义段落。
<p>这是一个段落。</p> <p>这是另一个段落。</p>
8. <a>
:定义超链接,用于链接到其他网页或同一网页的不同部分。
<a href="https://www.example.com">点击这里访问 example.com</a> <a href="#section2">跳转到第二部分</a>
9. <img>
:插入图片。
<img src="image.jpg" alt="示例图片" width="300" height="200">
10. <ul>
和 <ol>
:定义无序列表和有序列表。<li>
定义列表项。
<!无序列表 > <ul> <li>列表项1</li> <li>列表项2</li> <li>列表项3</li> </ul> <!有序列表 > <ol> <li>列表项1</li> <li>列表项2</li> <li>列表项3</li> </ol>
11. <table>
:定义表格。<tr>
定义表格行,<td>
定义表格单元格。<th>
定义表头单元格,使用 border
、cellpadding
、cellspacing
属性设置表格样式。
<!简单表格 > <table border="1"> <tr> <th>姓名</th> <th>年龄</th> <th>性别</th> </tr> <tr> <td>张三</td><td>25</td><td>男</td></tr> <tr><td>李四</td><td>30</td><td>女</td></tr> <tr><td colspan="2">王五</td><td rowspan="2">男</td></tr><tr><td colspan="2">赵六</td></tr></table> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <!更多表格样式></table></body></html><!DOCTYPE html><html><head><meta charset=utf8><title><