| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2034 人关注过本帖
标题:怎样用CSS来限制表格宽度?
只看楼主 加入收藏
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
结帖率:100%
收藏
 问题点数:0 回复次数:2 
怎样用CSS来限制表格宽度?
表头
<div >
<table  border=1 width=800>
<tr><td rowspan=2 align=center width=70>年级</td><td align=center rowspan=2 width=70>班级数</td><td colspan=15 align=center>开设学科</td><td align=center rowspan=2 width=80>&nbsp;操作&nbsp;</td></tr><tr><td width=40 align=center>语文</td><td width=40 align=center>数学</td><td width=40 align=center>英语</td><td width=40 align=center>物理</td><td width=40 align=center>化学</td><td width=40 align=center>生物</td><td width=40 align=center>政治</td><td width=40 align=center>历史</td><td width=40 align=center>地理</td><td width=40 align=center>信息</td><td width=40 align=center>体育</td><td width=40 align=center>音乐</td><td width=40 align=center>美术</td><td align=center width=60 fixed>添加</td></tr></table></div>

表格内容
<div>
<table width=800  border=1>
<tr><td width=70><select value="nianji[]"><option value="高一">高一</option><option value="高二">高二</option><option value="高三">高三</option><option value="补习">补习</option><option value="理补">理补</option><option value="文补">文补</option><option value="初一">初一</option><option value="初二">初二</option><option value="初三">初三</option><option value="初补">初补</option><option value="小一">小一</option><option value="小二">小二</option>  <option value="小三">小三</option><option value="小四">小四</option><option value="小五">小五</option><option value="小六">小六</option></select></td><td width=70 align=center><select value="banji[]"><%for i=1 to 50%><option value="<%=i%>"><%=i%></option><%next%></select></td><td width=40 align=center><input checked name="kemu1" type="checkbox" value="语文"></td><td width=40 align=center><input checked name="kemu2" type="checkbox" value="数学"></td><td width=40 align=center><input checked name="kemu3" type="checkbox" value="英语"></td><td width=40 align=center><input checked name="kemu4" type="checkbox" value="物理"></td><td width=40 align=center><input checked name="kemu5" type="checkbox" value="化学"></td><td width=40 align=center><input checked name="kemu6" type="checkbox" value="生物"></td><td width=40 align=center><input checked name="kemu7" type="checkbox" value="政治"></td><td width=40 align=center><input checked name="kemu8" type="checkbox" value="历史"></td><td width=40 align=center><input checked name="kemu9" type="checkbox" value="地理"></td><td width=40 align=center><input checked name="kemu10" type="checkbox" value="计算机"></td><td width=40 align=center><input checked name="kemu11" type="checkbox" value="体育"></td><td width=40 align=center><input checked name="kemu12" type="checkbox" value="音乐"></td><td width=40 align=center><input checked name="kemu13" type="checkbox" value="美术"></td><td align=center width=80><input type="text" name="kemu14" value="" size=4></td><td width=80 align=center><font color=red>X</font></td></tr>
</table></div>

效果图:
图片附件: 游客没有浏览图片的权限,请 登录注册

显然并不对齐,有什么办法使之对齐?
搜索更多相关主题的帖子: CSS 宽度 表格 英语 数学 
2008-07-05 07:00
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
收藏
得分:0 
并且代码重复较多,我想用CSS来限制这种表的宽度使之与表头对齐,但用CSS好象限制不了
2008-07-05 07:02
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
收藏
得分:0 
在<STYLE>.... </style>中加
  table-layout: fixed;

就可控制
2008-07-05 20:09
快速回复:怎样用CSS来限制表格宽度?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020408 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved