打破长文本,在表格单元格内没有空格

问题描述 投票:0回答:2

我想像here那样对齐此文本,但是如果运行此代码,则我的较长文本在一行中,而文本“我的信息在两行中。如何在有限的宽度上对齐到更多行?

<html>
<head>
<style>

.div_name p{
    position: fixed;
    display:inline;
}

.div_city p{
    display:inline;
}

.div_info p{
    display:inline;
} 

 div.all_info {
  position: absolute;
  right: 30%;
  width: 200px;
  height: 100px;
  //border: 3px solid blue;
} 
</style>

</head>
<body>

<div class="all_info" align = "right"> 
<table>
<tr><td align="right" width150px><div class="div_name:">Your name: </td> <td align="left" width=200px><p id="myname">David</p></td></div></tr>  
<tr><td align="right" width=150px><div class="div_city:">Your city: </td> <td align="left" width=200px><p id="mycity">Prageu</p></td></div></tr>
<tr><td align="right" width=250px><div class="div_info:">Your Informations: </td> <td align="left" width=200px><p id="myinfo">myinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfo</p></td></div></tr>
</table>    
</div>
</body>
</html>
html css html-table line text-align
2个回答
0
投票

秘密是在每个word-break:break-all单元格上使用word-break:break-all


0
投票
div
© www.soinside.com 2019 - 2024. All rights reserved.