2013-01-11 80 views
0

嘿,伙计们一个独立的“一”的标签,我有以下布局:将在“TD”标签的底部

<table> 
    <tr> 
    <td> 
     <div> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     </div> 
    </td> 
    <td> 
     <div> 
     I´m smaller than the other<br> 
     I´m smaller than the other 
     </div> 
     <a href="">I should be at the bottom of my parent td</a> 
    </td> 
    </tr> 
</table> 

http://jsfiddle.net/BqxuM/

现在我要放置在了一个标签在td-tag底部的第二个td-tag! 我尝试了许多不同的事情来完成这个,但没有成功。

那么有人有答案让我这个工作? PS:如果没有js/jquery“黑客”,我会非常好。

+0

你有某种形式的图表?很难理解你需要什么。 – Kyle

回答

2

如果这是您将使用比仅结构使用position: relative;<table>position: absolute;<a>

Demo

CSS相对

table { 
    border: solid 1px black; 
    position: relative; 
} 

td { 
    padding: 5px; 
    border: solid 1px black; 
} 

a { 
    position: absolute; 
    bottom: 0; 
} 
+0

位置:绝对仅适用于页面无法滚动的情况。 – Vogel612

+0

@ Vogel612它的工作原理,你只需要把你的位置绝对div与位置相对格子 –

+0

正确的是,但没有,你会杀死整个布局;) – Vogel612

0

使用position:

td { 
    padding: 5px; 
    border: solid 1px black; 
    position: relative; 
} 

td a { 
    position: absolute; 
    bottom: 0px; 
} 
1

CSS

.my-bottom-link-parent { 
    position:relative; 
    /* padding-bottom: the height of the a element */ 
} 

.my-bottom-link-parent a { 
    position:absolute; 
    bottom:0; 
} 

HTML

<table> 
    <tr> 
    <td> 
     <div> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     I´m bigger than the other<br> 
     </div> 
    </td> 
    <td class="my-bottom-link-parent"> 
     <div> 
     I´m smaller than the other<br> 
     I´m smaller than the other 
     </div> 
     <a href="">I should be at the bottom of my parent td</a> 
    </td> 
    </tr> 
</table> 
1

是否必须是在同一个TD?

如何:

<table> 
    <tr> 
     <td> 
      <div>big<br /> div</div> 
     </td> 
     <td> 
      <div>small div</div> 
     </td> 
    </tr> 
    <tr> 
     <td> 
     </td> 
     <td> 
      <a href="#">link here</a> 
     </td> 
    </tr> 
</table> 
0

这是一个例子,你如何能做到这一点:

parrent:位置:亲属; 孩子:位置:绝对;显示:块;底部:0;

td { 
padding: 5px; 
border: solid 1px black; 
position:relative; 
} 

a{ 
display:block; 
bottom:0; 
position:absolute; 
}  

http://jsfiddle.net/BqxuM/4/