CSS ellipsis not working within Bootstrap 3 thumbnail header

2.1k views Asked by At

I can't figure out how to make css:ellipsis work inside Bootstrap 3 thumbnail headers. It's working flawlessly within the body text, but no luck so far with the header. I'm using last version of Chrome.

jsfiddle link

html

<div class="col-sm-4 col-md-3 col-lg-2 thumbnailcontainer">
  <div class="thumbnail">
    <img src="http://animalia-life.com/data_images/bird/bird1.jpg" alt="image">
    <div class="caption">
      <div class="thumbnailheader"><h3>This text is too long to fit inside its container.</h3></div>
      <p>Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id.</p>
      <p><a href="#" class="btn btn-default center-block" role="button">Open</a></p>
    </div>
  </div>
</div>

css

.thumbnailheader, 
.thumbnail p
{
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

Any ideas?

1

There are 1 answers

1
Reinder Wit On BEST ANSWER

You need to define the CSS directly on the elements themselve (in this case the <h3>). If you set this on the parent element, the overflow:hidden of the parent will not 'trigger' the ellipsis of the <h3>

.thumbnailheader h3, .thumbnail p
{
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

here's the updated fiddle: http://jsfiddle.net/mA6Za/124/