1 采用表格布局完成“CASIO计算器”外观设计,其中表格的每一个单元格均需要设计带边框。
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>计算机</title>
<style>
strong{
background-color: #ffffff;
}
.as{
width: 150px;
font-size: 20px;
}
</style>
</head>
<body>
<table align="center" width="500" border="3" cellpadding="5px" cellspacing="5px" bgcolor="#808080">
<tr >
<td width="50" valign="middle" align="left" class="as"><strong>CASIO.</strong></td>
</tr>
<tr bgcolor="#ffffff">
<td width="600" valign="middle" align="left"><br /><br /><br /></td>
</tr>
<table align="center" width="500" border="3" cellpadding="10px" cellspacing="24px" bgcolor="#808080">
<tr bgcolor="#ffffff">
<td width="50" align="center" border="1"bgcolor=>1</td>
<td width="50" align="center" border="1">2</td>
<td width="50" align="center" border="1">3</td>
<td width="50" align="center" border="1">+</td>
</tr>
<tr bgcolor="#ffffff">
<td width="50" align="center" border="1">4</td>
<td width="50" align="center" border="1">5</td>
<td width="50" align="center" border="1">6</td>
<td width="50" align="center" border="1">-</td>
</tr>
<tr bgcolor="#ffffff">
<td width="50" align="center" border="1">7</td>
<td width="50" align="center" border="1">8</td>
<td width="50" align="center" border="1">9</td>
<td width="50" align="center" border="1">*</td>
</tr>
<tr bgcolor="#ffffff">
<td width="50" align="center" border="1">0</td>
<td width="50" align="center" border="1">=</td>
<td width="50" align="center" border="1">CE</td>
<td width="50" align="center" border="1">/</td>
</tr>
</table>
</table>
</body>
</html>
效果图;
2 编写程序“登录界面”
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>登录页面</title>
<style type="text/css">
body{
text-align: center;
}
fieldset {
width: 400px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend align="middle">登录页面</legend>
<tr>
用户名:<input type="text" name="name" /><br />
</tr>
<tr>
密 码:<input type="text" name="name" /><br>
</tr>
<tr>
类 型:
<td><input type="radio" name="guangli" />管理员
<input type="radio" name="putong" />普通用户<br />
<input type="checkbox" name="n1">记住密码
<input type="checkbox" name="n2">自动登录<br />
</td>
</tr>
<tr>
<input type="submit" name="button" value="提交" />
<input type="reset" name="button2" value="重置" />
</tr>
</fieldset>
</form>
</body>
</html>