Html标签

xiaoxiao2021-07-27  69

# 最小html5网页代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>文档标题</title> </head> <body> 文档内容...... </body> </html> # 标题 <h1>这是标题 1</h1> <h2>这是标题 2</h2> <h3>这是标题 3</h3> <h4>这是标题 4</h4> <h5>这是标题 5</h5> <h6>这是标题 6</h6> # 段落,段落里使用<br>换行, 空格,水平线<hr> <p>这是一个段落。</p> # 链接,target="_blank"是在新的窗口打开 <a href="http://www.baidu.com" target="_blank">这是一个链接</a> # 图像,属性是写在"",使用小写,alt=是当图片找不到时显示的文字,title=是鼠标移动上去显示 <img src="/images/logo.png" width="111" height="111" alt="波多野结衣" title="美女"> # 文本 <b>加粗文本</b> <i>斜体文本</i> # 表格,<tr>行,<td>列,border="1"边框1 <table border="1"> <thead> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> </thead> <tbody> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </tbody> </table> # 列表,ul是无序列表(type=none),ol是有序列表(type= start=) <ul> <li>Coffee</li> <li>Milk</li> </ul> # form表单 form表单提交数据的几个注意事项: 1. 所有获取用户输入的标签都必须放在form表单里面 2. action控制着往哪儿提交,=后面是网址 3. input\select\textarea 都需要有name属性,提交数据的key 4. 提交按钮 <input type="submit"> 5. placeholde=“”文本框默认的比较浅的占位文字 # nav标签 html5的新标签 # 属性 class:为html元素定义一个或多个类名(classname)(类名从样式文件引入) id:定义元素的唯一id style:规定元素的行内样式 前端补全插件emmt 标签分类: 块级标签 h1~h6 <div>, <p>,<form>, <ul><li> 默认占浏览器宽度 能设置长和宽 居中用style="margin:0 auto;" 内联标签(行内标签) a img u s i b span 根据内容决定长度 不能设置长和宽 居中用style="text-align: center;" 标签的嵌套规则 行内标签不能嵌套块级标签 p标签不能嵌套块级标签
转载请注明原文地址: https://www.6miu.com/read-4823409.html

最新回复(0)