# 百度前端(一)HTML
# HTML 语法规范
1 2 3 4 5 6 7 8 9 10 11 12 13 14 <!DOCTYPE html > <html lang ="en" > <head > <meta charset ="UTF-8" > <meta name ="keywords" content ="养猪专业户,养猪大厂" > <meta name ="description" content ="来这个地方养猪" > <title > HTML学习</title > </head > <body > 网页内容 </body > </html >
# HTML 常用标签
1. 标题标签
<h1></h1>…<h6></h6>
字体大小逐级递减
2. 段落标签
<p></p>
分段,文本内容
3. 换行标签
<br>
单标签,遇到 br 换行
4. 语义标签
<b></b>。<i></i>。<s></s>。<u></u> 对应 <strong>。<em>。<del>。<ins>
加粗 倾斜 删除 下划线
5. 布局标签
<div></div> <span></span>
div 独占一行 span 占小块
6. 图像标签
<img src=“C:\003.jpg” height=100 title=“学习用… border=10”>
alt: 图片加载失败显示 title: 鼠标指向时显示 border: 边框粗细
7. 链接标签
<a href=“跳转目标” target=“弹出方式”> 链接宿主文本或图像 </a>
target:要么当前页面弹出,要么新开页面 href 外部链接:如 https://www.meituan.com 内部链接:href=“xxx.”
8. 表格标签
<table></table> <th>…</th> 定义表头单元格 <tr>…</tr> 定义一行标签 <td>…</td> 定义单元格标签
colspan 属性跨行 rowspan 跨列
1. 特殊符号
7. 链接标签补充:
a. 外部链接:如 https://baidu.com
b. 内部链接:href=“xxx.html” 跳转到自己制作的 html
c. 空连接:# href=“#”
d. 下载链接:href=“一个压缩包或文件的地址” 则会下载这个文件 (.zip、.doc…)
e. 锚点链接:某个标签内加入 id=“ID_name” 添加锚点,链接 href=“#ID_name”, 该链接用于跳转到锚点
# HTML5 语义标签
<nav>
<header>
<article>
<section>
<aside>
<footer>
# * 表单
查看效果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 <!DOCTYPE html > <html lang ="en" > <head > <meta charset ="UTF-8" > <title > 表单学习</title > </head > <body > <h2 > 登录注册</h2 > <form action ="1.我的第一个网页.html" method ="get" > <p > QQ:<input type ="text" name ="username" placeholder ="请输入用户名" maxlength ="10" > </p > <p > 密码:<input type ="password" placeholder ="输入你的密码" name ="password" > </p > <p > 性别: <input type ="radio" value ="boy" name ="sex" checked > 男 <input type ="radio" value ="girl" name ="sex" > 女 </p > <p > <input type ="checkbox" value ="sleep" name ="hobby" > 睡觉 <input type ="checkbox" value ="game" name ="hobby" > 打游戏xd <input type ="checkbox" value ="eat" name ="hobby" > 吃 <input type ="checkbox" value ="code" name ="hobby" checked > 写代码 </p > <p > <input type ="button" name ="btnl" value ="点击变大" > <input type ="image" src ="../../resources/image/1.jpg" width ="60" height ="60" value ="点击变小" > </p > <p > 国家 <select name ="country" > <option value ="China" selected > 中国</option > <option value ="America" > 美国</option > <option value ="Switzerland" > 瑞士</option > </select > </p > <p > 反馈: <br > <textarea name ="textarea" cols ="30" rows ="10" title ="retrun" > </textarea > </p > <p > <input type ="file" value ="选择文件" > </p > <p > 邮箱 <input type ="email" name ="email" > </p > <p > URL <input type ="url" name ="url" > </p > <p > 商品数量 <input type ="number" name ="num" min ="0" max ="100" > </p > <p > 音量: <input type ="range" name ="voice" min ="0" max ="100" > </p > <p > 搜索: <input type ="search" name ="search" > </p > <p > <label for ="mark" > |你点我试试|</label > <input type ="text" id ="mark" name ="123" > </p > <p > 只读 <input type ="text" size ="20px" value ="呜呜呜" readonly > </p > <p > 自定义验证 <input type ="myemail" pattern ="填入正则表达式" > </p > <footer > <p > <input type ="submit" > <input type ="reset" > </p > </footer > </form > </body > </html >