将<td>中的div与<td>的顶部对齐

twi*_*ter 8 html css html-table

更新:添加了jsfiddle:http://jsfiddle.net/WgzgF/11/

我有一堆桌子<td>.每个td都有一个div .tdcont,它就像是td中所有内容的包装器.在.tdcont,我有两组div .alwaystop.below-at.

<td class="table-td">
   <div class="tdcont">
      <div class="alwaystop">           
         <div class="at1">at1</div>
         <div class="at2">at2</div>
         <div class="at3">at3</div>
      </div>            
      <div class="below-at">
         <div class="bat1">bat1</div>
         <div class="bat2">bat2</div>
         <div class="bat3">bat3</div>
      </div>
   </div>
</td>
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是它alwaystop本身应该与单元格的顶部边界对齐,并且below-at应该像这样在它下面

_____________________________________________________
at1 at2 at3       | at1 at2 at3     | at1 at2 at3    |
bat1 bat2 bat3    | bat1 bat2 bat3  | bat1 bat2 bat3 |
small image here  | big image here  |                |
                  | is taking lots  |                |
                  | of space        |                |
__________________|_________________|________________|      
Run Code Online (Sandbox Code Playgroud)

我发现的是,alwaystop并且below-at像你在这个小提琴http://jsfiddle.net/WgzgF/11/中看到的那样垂直居中,所以如果这一行中的一个相邻单元格很长,那么alwaystop这个行的高度就像这样

_____________________________________________________
                  | at1 at2 at3     |                |
                  | bat1 bat2 bat3  |                |
at1 at2 at3       | big image here  | at1 at2 at3    |
bat1 bat2 bat3    | is taking lots  | bat1 bat2 bat3 |
small image here  | of space        |                |
__________________|_________________|________________|      
Run Code Online (Sandbox Code Playgroud)

我想要做的是alwaystop始终从单元格的顶部开始,而不管相邻单元格的高度,然后below-at是它.我怎样才能做到这一点?

我应该补充一点,我的内容alwaystop是浮动的,内容也是below-at如此,因此它们应该像td中的2行一样.

.at1, .at2, .at3{ 
   float:left; 
}
.bat1, .bat2, .bat3{ 
   float:left; 
}
Run Code Online (Sandbox Code Playgroud)

alwaystop和under-at的css是空的.我尝试了很多像垂直对齐和绝对定位的东西,但没有任何效果,我只是放弃并删除了它们.

.alwaystop{ 
}
.below-at{
}
Run Code Online (Sandbox Code Playgroud)

Exe*_*ian 11

试试这个:

.table-td {
    border: 1px solid red;
    vertical-align: top;
}
Run Code Online (Sandbox Code Playgroud)


Anr*_*rgh 3

我已经按照@Damien 在评论中建议的方式进行了演示:

http://jsfiddle.net/AnrietteC/WgzgF/

如果我理解正确的话,它似乎正在做你想做的事。