HTML常用标签及表格、表单、列表

1:HTML常用标签

<a href=" ">这是一个链接</a>  
        //href="#"空链接
<a href=" " target="_blank">新窗口打开</a>
<b>加粗文本</b>
<i>斜体文本</i>
<code>电脑自动输出</code>
<sub>下标</sub> 
<sup>上标</sup>
<base href="//www.w3cschool.cn/images/" target="_blank"> 
      //默认链接
<link rel="stylesheet" type="text/css" href="mystyle.css"> 
      //链接到样式表
<script type="text/javascript" src="js/modernizr.js"></script> 
      //链接到js文件   
<img src="url" alt="some_text" width="304" height="228">
      //插入图片,alt指预备替换文本,最好指定宽高

2:表格

HTML 表格的基本结构:
  <table></table>:定义表格
  <th></th>:定义表格的标题栏(文字加粗)
  <tr></tr>:定义表格的行
  <td></td>:定义表格的列
例:
<table border="1">
<tr>
<th>A</th>
<th>B</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

显示如下:

AB
row 1, cell 1row 1, cell 2
row 2, cell 1row 2, cell 2

3:列表

1)无序列表

<ul>
  <li>咖啡</li>
  <li></li>
  <li>牛奶</li>
</ul>

显示如下:

  • 咖啡
  • 牛奶

2)有序列表

<ol>
  <li>咖啡</li>
  <li></li>
  <li>牛奶</li>
</ol>

<ol start="50">
  <li>咖啡</li>
  <li></li>
  <li>牛奶</li>
</ol>

显示如下:

  1. 咖啡
  2. 牛奶
  1. 咖啡
  2. 牛奶

4:表单

文本字段:
<form action="">
Name : <input type="text" name="name"><br>
Age : <input type="text" name="age">
</form>

密码字段:
<form action="get">
Username: <input type="text" name="user"><br>
Password: <input type="password" name="password">
</form>

单选:
<form action="">
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>

复选框:
<form action="">
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car 
</form>

下拉列表:
<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
</form>

文本域:
<textarea rows="10" cols="30">
我是一个文本框。
</textarea>

提交按钮:
<input type="submit" value="提交">

表单发送电子邮件:

<form action="MAILTO:someone@example.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name" value="your name"><br>
E-mail:<br>
<input type="text" name="mail" value="your email"><br>
Comment:<br>
<input type="text" name="comment" value="your comment" size="50"><br><br>
send time:<br>
<select name=time>
<option  value="2015">2015</option></br>
<option value="2016">2016</option></br>
<option  value="2017">2017</option></br>
</select></br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
Name:

E-mail:

Comment:


send time:
2015 2016 2017

5:基本格式:

<!DOCTYPE html>
<html>
<head>
 <title>title of the document</title>
 <link rel="stylesheet" href="css/font-awesome.min.css">
 <script type="text/javascript" src="js/modernizr.js"></script>    
 <style>
 ...css描述
 </style>
 <script>
 ...script描述
 </script>
</head>

<body style="background-color:yellow;">
<h2>This is a heading</h2>
<p>This is a paragraph</p>
</body>
</html>

6:meta元素

为搜索引擎定义关键词:    
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">

为网页定义描述内容:    
<meta name="description" content="Free Web tutorials on HTML and CSS">

定义网页作者:    
<meta name="author" content="Hege Refsnes">

每30秒钟刷新当前页面:   
<meta http-equiv="refresh" content="30">
  • 8
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值