如何使用仅使用css在具有锚点的表内显示带有省略号的文本

时间:2014-02-20 07:01:08

标签: html css

如何在不使用table-layout的情况下仅使用css在具有锚标记的表内显示带有省略号的文本:fixed;

<table>
  <tr>
    <td> 
      <a href="">
          very lengthy text
      </a> 
    </td>
 </tr>

4 个答案:

答案 0 :(得分:0)

使用css类 - &gt;

.truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

答案 1 :(得分:0)

在小提琴中尝试这个解决方案

Fiddle-ellipse

<table>
  <tr>
    <td> 
        <div class = "elipse">
      <a href="">
          very lengthy text
      </a> 
        </div>
    </td>
 </tr>

CSS

.elipse{
    background-color : aqua;
    border-radius : 50%;
    padding : 20px;
}

答案 2 :(得分:0)

你的意思是这样的: -

小提琴:http://jsfiddle.net/nikhilvkd/hU9Y2/1/

.ellipse{
    border:solid 1px #000;
    border-radius:30px;
    padding:0px 5px;
}
.ellipse2{
    border:solid 1px #000;
    border-radius:50%;
    padding:10px 5px;
}

答案 3 :(得分:0)

小提琴:http://jsfiddle.net/nikhilvkd/hU9Y2/2/

.ellipsis {

border-bottom: dotted 1px #000;
width: 7px;
margin-left: 2px;
height: 14px;
display: inline-block;
}