English 中文(简体)
• 如何改变在html囚室的宽度
原标题:how to change the width on an html cell
  • 时间:2011-10-27 20:15:13
  •  标签:
  • html
  • css

I have a html table which I would like to control the sizes of the cell manually. I am getting confused about how its supposed to work. First of all, there is a css attribute "table-layout" which is supposed to control whether or not the cell size is automatically set to the largest content in the column or to a fixed size. I tried setting the css width for the td elements using both table-layout=auto and =fixed, and both times the content shrinked from its original size. The problem is that it didn t shrink to the size I wanted to using either value for table-layout. Here is my css code:

table {table-layout:fixed;}
tr, td {border-style:solid;
  border-width:2px;}
.coursename{width:50px;}
.startdate {width:5px;} 
.isbn{width:10px;}
.author {width:20px;}
.booktitle{width:10px;}

第二,自动排位规则究竟是什么? 如果所有表层单元的内容一到一页,是否有一栏将首先缩小? 它们是否会消失?

问题回答

一种可能帮助的想法是,如果你在每一个囚室都有联系,就把这种联系确定为:

a { display: block; width: 30px; }

对于表层中每个囚室而言,如果是这样的话,你就会有固定住处的桌子。 规定:

I am still unsure what your problem is, but you could try {table-layout:inherit;} This should get the size from the parent element. Also, you could insert the css element into the html and have it override any other elements by preceding it with a ! {class="!width:300px;"}

希望这一帮助。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签