我试图将文本保留在div表格单元格的边框内,但没有剪裁。
问题是文本不会溢出其单元格div。请理解,文字的宽度不会超过div的宽度。
另外,当我删除" float:left"来自单元格div的元素,整个div表格搞乱了。
.table {
display: table;
width:302px;
padding: 0px;
margin:0;
text-align:center;
word-break:break-all;
}
.row {
display: table-row;
vertical-align:middle;
text-align:center;
margin: 0;
padding:0;
}
.cell {
display: table-cell;
float:left;
padding: 0px;
min-height: 100px;
border: 1px solid #000;
margin-left:5px;
margin-right:0px;
margin-bottom: 0px;
height: auto;
margin-top:0px;
width:300px;
}
答案 0 :(得分:0)
我试过你提供的CSS,似乎没问题。你能提供HTML吗?
.table {
display: table;
width: 302px;
padding: 0px;
margin: 0;
text-align: center;
word-break: break-all;
}
.row {
display: table-row;
vertical-align: middle;
text-align: center;
margin: 0;
padding: 0;
}
.cell {
float:left;
min-height: 100px;
border: 1px solid #000;
margin-left: 5px;
margin-right: 0px;
margin-bottom: 0px;
height: auto;
margin-top: 0px;
width: 300px;
}

<div class="table">
<div class="row">
<div class="cell">asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf</div>
</div>
</div>
&#13;