style.css

.product-information p { color: #696763; font-family: 'Roboto', sans-serif; margin-bottom: 5px; overflow: hidden; } 

index.html

  <div class="product-image-wrapper"> <div class="single-products"> <div class="productinfo text-center"> <?= Html::img($mainImg->getUrl('207x183'), ['alt' => $hit->name])?> <h2>$<?= $hit->price?></h2> <p><a href="<?= \yii\helpers\Url::to(['product/view', 'id' => '7']) ?>"><?= $hit->name?></a></p> <a href="<?= \yii\helpers\Url::to(['cart/add', 'id' => $hit->id])?>" data-id="<?= $hit->id?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a> </div> </div> 

if through "overflow: hidden;", then it does not work

  • show not the initial code but already ready Varyan without php-code - klifort

3 answers 3

style.css

 p { width: 80%; overflow: hidden; white-space: nowrap; word-wrap: normal; /* для IE */ padding-left: 40px; text-overflow: ellipsis; } 

    Add to css .product-information p {display: none;}

      You can hide it in two ways via css, using display: none and using JS - this is $ ("# idorclassblock"). Hide ().