要点:在CSS中用到了td{ white-space:nowrap;},同时在把两个表格嵌套在一个表格里,并且这两个表格的
宽度设为100%(其余的不行,如80%).
代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看员工信息</title>
<style type="text/css">
*{
font-size:13px;
}
/*
author:luoqinglong
E-mail:luoqinglong0102@163.com
date:2009-01-17
*/
td{ white-space:nowrap;
}
</style>
</head>
<body>
<table width="98%" border="1" bordercolor="#9DCF85" cellpadding="0" cellspacing="0">
<tr><td>
<table width="98%" border="0" align="center" cellspacing="0" >
<tr>
<td >当前位置:首页>查看员工信息</td>
</tr>
</table>
<br/>
<table width="100%" border="0" align="center" cellpadding="3" bgcolor="#9DBCF7" >
<tr height="35" >
<td width="25%"><input type="button" value="增加" id="btn_add"/>
<input type="button" value="修改" id="btn_modify"/>
<input type="button" value="删除" id="btn_del"/></td>
<form action="" id="" method="post">
<td width="75%" align="left" ><input type="text" id="keyword" size="15"/><input type="button" value="查询" class="bluebuttoncss" /></td>
</form>
</tr>
</table>
<table width="100%" border="1" align="center" cellspacing="0" cellpadding="3" bordercolor="#6DC1D3" >
<tr >
<td width="15%" >中国加油</td>
<td width="20%" >中加油</td>
<td width="23%">加油</td>
<td width="42%"> </td>
</tr>
</table>
</td></tr></table>
</body>
</html>