css - How to use text-overflow inside Bootstrap column? -


suppose have row fixed height , inserted text column. if it's long wanna cut off , @ end of line 3 dots supposed added this:

enter image description here

i'm using text-overflow: ellipsis; attribute in row can't work.

enter image description here

jsfiddle

what doing wrong?

html

<div class="container">   <div class="row text">         <div class="col-xs-4" style="border: solid">  long text!  long text!  long text!  long text! end! long text! end! long text! end! long text! end!     </div>   </div>         </div> 

css

.row {     margin: 2px 0; }  .text {     word-wrap: break-word;     height: 50px;     text-overflow: ellipsis; } 

if want using css, try below code :

html :

<div class="container">   <div class="row">         <div class="col-xs-4" style="border: solid">         <div class="text">             long text!  long text!  long text!  long text! end! long text! end! long text! end! long text! end!         </div>     </div>   </div>         </div> 

css:

.row {     margin: 2px 0; }  .text {     display: block;     display: -webkit-box;     max-width: 400px;     height: 50px;     margin: 0 auto;     line-height: 1.2;     -webkit-line-clamp: 3;     -webkit-box-orient: vertical;     overflow: hidden;     text-overflow: ellipsis; } 

here jsfiddle

for understanding line clapming in css line clamping


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

jquery - ReferenceError: CKEDITOR is not defined -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -