您的位置:首页 > Web前端 > HTML

HTML常见标签学习

2016-07-12 10:41 435 查看
真是好久都没接触HTML了,难免有些生疏。为什么学过的东西很快就会忘掉呢?知乎上有人说学过的东西不常用,那么忘记也是常有的事,学过之后不用和忘记就是一码事,你学了但不用还不如忘记的好。

由于我想从事的并不是web前端开发,但是作为一名合格的web开发者,就应该了解一些web前端的一些知识,比如HTML和CSS等。故此文是对HTML常见标签的一些简单总结。

HTML( Hyper Text Markup Language),超文本标记语言。HTML文件的后缀名一般是: .htm, .html。

关于表格的HTML标签的介绍

<table>
表示一个表格,
<tr>
表示表格的一行,
<td>
表示表格一行中的一个单元格,
<th>
<td>
一样,只不过
<th>
标签让内容居中并加粗,常用于表示表头的信息。

例:

<table border="1" align="center" width="80%">
<tr>
<th>aa</th>    <!-- <th>标签让内容居中并加粗,用于表示表头的信息 -->
<th>bb</th>
<th>cc</th>
</tr>
<tr>
<td align="center"><b>dd</b></td> <!-- 使用<td>标签达到和<th>标签同样的效果 -->
<td align="center"><b>ee</b></td>
<td align="center"><b>ff</b></td>
</tr>
</table>


关于超链接的HTML标签介绍

<a>
表示超链接。

例:

<a href="http://www.baidu.com">这是一个链接</a>


href属性表示点击超链接跳转到哪个地方。

关于表单的HTML标签的介绍

<form>
即表示表单。表单里面可以存放以下类型的元素:

text

username: <input type="text" value="hello world">


value属性指示初始化值。

password

<input type="password">


checkbox

兴趣:学习<input type="checkbox">旅游<input type="checkbox">睡觉<input type="checkbox">


radio

性别:男<input type="radio" name="gender">女<input type="radio" name="gender">


注意:name属性值一定要相同,即代表单选框在同一个组里面。

select

学历:<select>
<option>小学</option>
<option>初中</option>
<option>高中</option>
<option>大学</option>
</select>


textarea

评论:<textarea></textarea>


file

文件上传:<input type="file">


submit

<input type="submit" value="submit">


reset

<input type="reset" value="reset">


注意:reset是让页面回到最初的状态。

button

<input type="button" value="button" onclick="javascript:alert('hello world');">


点击button按钮弹出一个带有hello world内容的对话框。

还有一个关于图片的HTML标签——
<img>


<img src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png">


src属性表示图片的位置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: