html基础回顾

mac2022-06-30  95

一 Html

<head>标签:

1 <head> 2 <title>网页标题</title> 3 <meta> 4 <link> 5 <style>...</style> 6 <script>...</script> 7 </head>

<body>标签:

1 <p>段落</p> 2 <h1>标题</h1> 3 4 //需要强调的文本 5 <em>需要强调的文本</em> 6 <strong>需要强调的文本</strong> 7 8 //设置单独样式 具体在头文件中<style>设具体样式 9 <span>文本</span> 10 11 <q>引用文本</q> 12 <blockquote>引用文本</blockquote> 13 <br /> //空标签 作用同回车 14 <hr /> //添加水平横线 15   //作用同空格 16 <address>联系地址信息</address> 17 <code>var i=i+300;</code> 18 <pre>语言代码段</pre>

<body>标签2:

//添加无顺序信息列表 <ul> <li>信息</li> <li>信息</li> ...... </ul> //添加有顺序信息列表 <ol> <li>信息</li> <li>信息</li> ...... </ol> //封装盒子 <div id="版块名称"></div> //插入表格 <table summary="表格简介文本"> <caption>标题文本</caption> <tbody> <tr> //表格的一行 <th>班级</th> //表格的一个单元格 <th>学生数</th> <th>平均成绩</th> </tr> <tr> <td>一班</td> <td>30</td> <td>89</td> </tr> </tbody> </table>

<body>标签3:

//使用<a>标签,链接到另一个页面 其中target="_blank"作用是在新窗口打开 <a href="目标网址" title="鼠标滑过显示的文本" target="_blank">链接显示的文本</a>//插入图片<img src="图片地址" alt="下载失败时的替换文本" title = "提示文本">

 

<body>标签4:

表单是可以把浏览者输入的数据传送到服务器端,这样服务器端程序就可以处理表单传过来的数据。

 

1 /* 2 <form method="传送方式" action="服务器文件"> 3 4 1.<form> :<form>标签是成对出现的,以<form>开始,以</form>结束。 5 6 2.action :浏览者输入的数据被传送到的地方,比如一个PHP页面(save.php)。 7 8 3.method : 数据传送的方式(get/post)。 9 */ 10 11 <form method="post" action="save.php"> 12 <label for="username">用户名:</label> 13 <input type="text" name="username" /> 14 <label for="pass">密码:</label> 15 <input type="password" name="pass" /> 16 </form> 1 //多行输入时标签为textare 2 3 <textarea rows="行数" cols="列数"> 4 默认文本 5 </textarea> 6 7 /* 8 单选框 复选框 9 1、type: 10 当 type="radio" 时,控件为单选框 11 当 type="checkbox" 时,控件为复选框 12 2、value:提交数据到服务器的值(后台程序PHP使用) 13 3、name:为控件命名,以备后台程序 ASP、PHP 使用 14 4、checked:当设置 checked="checked" 时,该选项被默认选中 15 */ 16 17 <input type="radio/checkbox" value="" name="名称" checked="checked"/> 18 19 //下拉框选择 在select在后加属性 multiple="multiple" 可以实现复选 20 21 <form action="save.php" method="post" > 22 <label>爱好:</label> 23 <select> 24 <option value="看书">看书</option> 25 <option value="旅游">旅游</option> 26 <option value="运动">运动</option> 27 <option value="购物">购物</option> 28 </select> 29 </form> 30 31 //提交按钮 重置按钮 32 <form method="post" action="save.php"> 33 <label for="myName">姓名:</label> 34 <input type="text" value=" " name="myName " /> 35 <input type="submit" value="提交" name="submitBtn" /> 36 <input type="reset" value="重置" /> 37 </form>

<label>标签:

label标签不会向用户呈现任何特殊效果,它的作用是为鼠标用户改进了可用性。如果你在 label 标签内点击文本,就会触发此控件。就是说,当用户单击选中该label标签时,浏览器就会自动将焦点转到和标签相关的表单控件上(就自动选中和该label标签相关连的表单控件上)。

注意:标签的 for 属性中的值应当与相关控件的 id 属性值一定要相同。

1 <form> 2 <label for="male">男</label> 3 <input type="radio" name="gender" id="male" /> 4 <br /> 5 <label for="female">女</label> 6 <input type="radio" name="gender" id="female" /> 7 <label for="email">输入你的邮箱地址</label> 8 <input type="email" id="email" placeholder="Enter email"> 9 </form>

 

转载于:https://www.cnblogs.com/Mask-D/p/9154560.html

最新回复(0)