今天做了什么

HTML 布局 - 使用<div> 元素
div 元素是用于分组 HTML 元素的块级元素。

下面的例子使用五个 div 元素来创建多列布局:

实例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<div id="container" style="width:500px">

<div id="header" style="">
<h1 style="margin-bottom:0;">主要的网页标题</h1></div>

<div id="menu" style="height:200px;width:100px;float:left;">
<b>菜单</b><br>
HTML<br>
CSS<br>
JavaScript</div>

<div id="content" style="height:200px;width:400px;float:left;">
内容在这里</div>

<div id="footer" style="clear:both;text-align:center;">
版权 © runoob.com</div>

</div>

</body>
</html>

HTML 布局 - 使用表格
使用 HTML <table> 标签是创建布局的一种简单的方式。

大多数站点可以使用 <div> 或者 <table> 元素来创建多列。CSS 用于对元素进行定位,或者为页面创建背景以及色彩丰富的外观。

lamp 即使可以使用 HTML 表格来创建漂亮的布局,但设计表格的目的是呈现表格化数据 - 表格不是布局工具!
下面的例子使用三行两列的表格 - 第一和最后一行使用 colspan 属性来横跨两列:

实例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<table width="500" border="0">
<tr>
<td colspan="2" style="">
<h1>主要的网页标题</h1>
</td>
</tr>

<tr>
<td style="width:100px;">
<b>菜单</b><br>
HTML<br>
CSS<br>
JavaScript
</td>
<td style="height:200px;width:400px;">
内容在这里</td>
</tr>

<tr>
<td colspan="2" style="text-align:center;">
版权 © runoob.com</td>
</tr>
</table>

</body>
</html>

HTML 表单和输入
HTML 表单用于收集用户的输入信息。

HTML 表单表示文档中的一个区域,此区域包含交互控件,将用户收集到的信息发送到 Web 服务器。

HTML 表单通常包含各种输入字段、复选框、单选按钮、下拉列表等元素。

以下是一个简单的HTML表单的例子:

<form> 元素用于创建表单,action 属性定义了表单数据提交的目标 URL,method 属性定义了提交数据的 HTTP 方法(这里使用的是 "post")。
<label> 元素用于为表单元素添加标签,提高可访问性。
<input> 元素是最常用的表单元素之一,它可以创建文本输入框、密码框、单选按钮、复选框等。type 属性定义了输入框的类型,id 属性用于关联 <label> 元素,name 属性用于标识表单字段。
<select> 元素用于创建下拉列表,而 <option> 元素用于定义下拉列表中的选项。
实例
<form action="/" method="post">
<!-- 文本输入框 -->
<label for="name">用户名:</label>
<input type="text" id="name" name="name" required>

<br>

<!-- 密码输入框 -->
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>

<br>

<!-- 单选按钮 -->
<label>性别:</label>
<input type="radio" id="male" name="gender" value="male" checked>
<label for="male">男</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">女</label>

<br>

<!-- 复选框 -->
<input type="checkbox" id="subscribe" name="subscribe" checked>
<label for="subscribe">订阅推送信息</label>

<br>

<!-- 下拉列表 -->
<label for="country">国家:</label>
<select id="country" name="country">
<option value="cn">CN</option>
<option value="usa">USA</option>
<option value="uk">UK</option>
</select>

<br>

<!-- 提交按钮 -->
<input type="submit" value="提交">
</form>

复选框(Checkboxes)
<input type="checkbox"> 定义了复选框。

复选框可以选取一个或多个选项: