我需要在表格單元格的頂部角落放置一個元素,文本應該放在底部。我使用vertical-align:bottom來移動所有的文本,但是現在我有一個top元素的問題,因爲table-cell不支持相對定位......任何想法如何做到這一點?如何將一些元素放置在表格單元格上,還有一些放在底部?
<div style = "display: table-cell; vertical-align: bottom">
<div class = "top"> Top corner</div>
<h2> some text in the bottom </h2>
<h3> some more text in the bottom </h3>
</div>
編輯:它應該是這個樣子
+-----------+ +-----------+ +------------+
|top text | |top text | |top text |
| | | | | |
|some long | | | | |
|text | | | | |
|more long | | | | |
|text | | | | |
|end of | | | |some text |
|text | |text | |text |
|<button> | |<button> | |<button> |
+-----------+ +-----------+ +------------+
這一切都被包裹在顯示一個div:表。 我想使用display:table-cell的原因是保持這些列的高度相同並且仍然靈活以適應列中不同長度的文本。
你能描述你希望這看起來多一點?你的包裝div有沒有適用於它的樣式(其他的是內聯樣式)。有一個高度?您想要.top div在哪個頂角?也許模擬圖像可能有助於獲得一些很好的答案。 – 3dgoo
你想要看起來像這樣的東西嗎? http://jsfiddle.net/Kse3g/1/只是沒有通過在CSS中使用顯式高度來僞造結果? – 3dgoo
不能加載該鏈接,對不起!我在描述中添加了一個'圖片':) – skyisred