CSS使表格不变形(原创)


要点:在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 >当前位置:首页&gt;查看员工信息</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%">&nbsp;</td>
</tr>
</table>
</td></tr></table>
</body>

</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值