小提琴位於:https://jsfiddle.net/9me1rrLm/爲什麼我的div表格在調整大小時會失去底部邊框?
<body style="padding: 0px; margin: 0px; overflow-y: scroll; overflow-x: hidden; width: 100%;">
<div style="height:50px; overflow:hidden;">
<div style="display: table; width: 100%; height: 100%;">
<div style="display: table-row;">
<div style="display: table-cell; border-style: solid; width: 10%; vertical-align: top;">
0002
</div>
<div style="display: table-cell; border-style: solid; width: 40%; vertical-align: middle;">
Johnny Five Johnny Five Johnny Five
</div>
<div style="display: table-cell; border-style: solid; width: 30%; vertical-align: bottom;">
Robotin'
</div>
<div style="display: table-cell; border-style: solid; width: 20%; vertical-align: bottom;">
[email protected]
</div>
</div>
</div>
</div>
</body>
當瀏覽器是有點大多擴大,沒有任何問題:
見,縮小瀏覽器之後,所以大多是擴大了,仍然沒有問題:
然後,只要我能縮小瀏覽器後,我失去的文字和底邊框:
爲什麼?我不想失去邊界,我希望儘可能多的文本留在單元格內(溢出不可見)。
謝謝。
編輯1:只是爲了澄清,我不想刪除溢出隱藏或增加表的高度。保持這一點是什麼使這個問題變得困難。例如,我在這裏具有相同的固定高度和溢出,除了忽略我的垂直對齊外,它的工作原理非常完美。所以我現在有兩個版本。一個使邊界消失,其他失去它的垂直alginment(但允許文本對齊):
https://jsfiddle.net/2L0cggds/
<body style="padding: 0px; margin: 0px; overflow-y: scroll; overflow-x: hidden; width: 100%;">
<div style="display: table; width: 100%; height: 50px;">
<div style="display: table-row; width: 100%; height: 50px;">
<div style="display: table-cell; width: 10%;height: 50px; border-style: solid;">
<div style="overflow:hidden; height: 50px;vertical-align:bottom;text-align:right;">
0004
</div>
</div>
<div style="display: table-cell; width: 40%;height:50px;border-style: solid;">
<div style="overflow:hidden; height:50px;vertical-align:bottom;text-align:right;">
Johnny Five Johnny Five Johnny Five
</div>
</div>
<div style="display: table-cell; width: 30%;height: 50px; border-style: solid;">
<div style="overflow:hidden; height: 50px;vertical-align:bottom;text-align:right;">
Robotin'
</div>
</div>
<div style="display: table-cell; width: 20%;height:50px;border-style: solid;">
<div style="overflow:hidden; height:50px;vertical-align:bottom;text-align:right;">
[email protected]
</div>
</div>
</div>
</div>
</body>
EDIT2:我知道這是可能的,因爲我看到在Visual Web GUI完成這件事。這花了我視覺的WebGUI分鐘看一看,看看如何邊框並沒有消失,文字停留在細胞內(小時HTML/CSS,在看不到盡頭和!):
這裏是我查看源代碼時看到的div瘋狂(它就像div內的div一樣......我只能展開並顯示出我們看到第一個單元格的位置......並突出顯示了50px ):
我的道歉。我不希望桌子的高度增加(這將成爲我想要的一個固定高度的標題),並且如果他們確實將其大小設置爲所有文字都不適合的程度,我可以儘可能多地顯示,其餘部分(溢出)被隱藏。這就是爲什麼我很難以及爲什麼要伸出援手。我知道這是可能的,因爲我已經看到了這一點。我將添加一些Visual WebGUI代碼的圖片,這些代碼完成了我想要實現的功能。 – JustLooking
想通了。去掉div表和使用html表。 – JustLooking