Html 包含php echo的div上的文本溢出?

Html 包含php echo的div上的文本溢出?,html,css,Html,Css,我一直在琢磨如何使用“文本溢出”功能 这是我的密码: <style type="text/css"> #filenm { white-space: nowrap; width: 100%; overflow: hidden; text-overflow: ellipsis; } </style> <td width="614" height="28" colspan="18" background="images/site_23.gif">

我一直在琢磨如何使用“文本溢出”功能

这是我的密码:

<style type="text/css">
#filenm {   white-space: nowrap;    width: 100%;    overflow: hidden;   text-overflow: ellipsis; } </style>

<td width="614" height="28" colspan="18" background="images/site_23.gif"><div id="filenm" style="display:block; font-family:Arial, Helvetica, sans-serif; color:#FFF; text-align:center;"> <?php $filename = $_GET['filename']; echo 'File Name:'.$filename.'.zip'; ?></div></td>

#filenm{空白:nowrap;宽度:100%;溢出:隐藏;文本溢出:省略号;}
我希望div'filenm'中的文本不会从它所在的框中溢出


非常感谢任何能帮忙的人

您需要为溢出设置一个高度,以使其正常工作:

    #filenm{
      height: 300px;
    } 

在本例中,如果文本不适合div,则隐藏该文本,并替换不适合点的文本。您可以在上看到工作版本

HTML 输出 这篇文章是


你能发布更多的源代码吗?仅凭不完整的代码片段很难看出其他因素。否定。。问题很简单,就像没有奶酪的饼干
<div> This text is way to long for this div</div>
  div {
      text-overflow:ellipsis;
      overflow:hidden;
      white-space:nowrap;
      width: 100px;
      padding: 10px;
    }