首页 > 技术文章 > 打点截断显示标题 自适应屏幕

gaoxue 2013-07-03 18:10 原文

屏幕伸长:

屏幕缩短:

html:注意,设置右浮动的time结构要在前面

<div>
  <p class="timeline">
    <a class="time">06-27 10:25</a>
    <a class="name" href="http://tt242.new.weibo.cn/u/1645882230?">先留长发再剃个秃子</a>
  </p>
  <p>不实信息</p>
</div>

css:

p.timeline {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.time {
    float: right;
    color: #919191;
}

  

推荐阅读