text-overflow: ellipsis with inline-block

2k views Asked by At

I have the following html code

<html>
  <head>
    <style>
      span {
        display:inline-block;
      }
    </style>
  </head>
  <body>
    <div style='width:60px; white-space:nowrap; overflow:hidden;
      text-overflow:ellipsis'>
      <span>abc</span> 
      <span>def</span> 
      <span>ghi</span> 
      <span>jkl</span>
    </div>
  </body>
</html>

The result looks like:

abc def g (the g is partially cropped)

Question) How can I make it looks like:

abc def g...

Thanks in advance!

0

There are 0 answers