English 中文(简体)
CSS: Fix 浏览高
原标题:CSS: Fix row height

标识:

<style>
    table
    {
        border:1px solid black;
        width:400px;
        height:300px;
        border-collapse:collapse;
    }
    table tbody
    {
        border:1px solid red;
    }
    table td
    {
        background:yellow;
        padding:10px;
        border-bottom:1px solid green;
        height:20px;
    }
</style>


<table>
<tbody>
    <tr><td>test</td></tr>
    <tr><td>test</td></tr>
</tbody>
</table>

What I need is that the rows won t stretch in height. Is there a way to have a fixed row height?

问题回答

传真 如果表层的高度大于你行的高度,则表层的增长率通常会与表层的高度成正比变化。 由于这个表格迫使你的行顶高,你可以去掉桌高,解决问题。 如果这是不可接受的,你还可以给牢房以明确的高度,并增加第三行,将auto的大小,以达到剩余的表高度。

CSS2的另一种选择是Max-Hels 财产,尽管它可能导致在表格中采取奇怪的行为。 http://www.w3schools.com/cssref/pr_dim_max-hala.asp

简言之,在每个囚室添加<条码>字=“线-小时:0”。 这在IEC中进行,因为它把现成和非主要文本的直线推到大约19px,迫使牢房在大多数版本的IEE中纵向扩展。 不管你是否有文字文本,国际电子计算中心要正确显示20px以下的浏览量。

如果需要的话,你也可以尝试:

<style type="text/css">
   ....
   table td div {height:20px;overflow-y:hidden;}
   table td.col1 div {width:100px;}
   table td.col2 div {width:300px;}
</style>


<table>
<tbody>
    <tr><td class="col1"><div>test</div></td></tr>
    <tr><td class="col2"><div>test</div></td></tr>
</tbody>
</table>

我先试了,但如果你在桌子上 put一.,以便在必要时有 s,那么你可以在那里插入一把 height子上固定的高度,并且应该把桌上row到固定的高度。

    
    table tbody
    {
        border:1px solid red;
    }
    table td
    {
        background:yellow;
        
        border-bottom:1px solid green;
        
        
    }
    .tr0{
        line-height:0;
     }
     .tr0 td{
        background:red;
     }
<table>
<tbody>
    <tr><td>test</td></tr>
    <tr><td>test</td></tr>    
    <tr class="tr0"><td></td></tr>
</tbody>
</table>




相关问题
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....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

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 ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签