好像我的JavaScript没有听我说。我只是想设置所有锚点'高度等于这些锚的最高高度。
<div class="col-md-4 col-sm-6 col-xs-12 product-items" ng-repeat="products in products">
<div class="product">
<h3>{{products.title}}</h3>
<img ng-href="" ng-src="{{products.thumbimg}}" alt="{{products.imgalt}}">
<a href="#">{{products.link}}</a>
<p>{{products.price | currency : ""}} BGN</p>
<p>Free Shiping</p>
<button>BUY</button>
</div>
</div>
(function () {
var app = angular.module("app", []);
var MainController = function ($scope, $http, $filter) {
...
...
...
/* Jquery */
var maxHeight = 0;
$("div .product a").each(function () {
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div .product a").height(maxHeight);
};
app.controller("MainController", MainController);
} ());
如何在h1,h2或h3 html元素上设置相等的高度
答案 0 :(得分:0)
<a>
元素是内联元素,您无法使用CSS中的height
更改内联元素的高度。您必须通过将此CSS代码添加到页面来将它们更改为内联块元素:
a {
display: inline-block;
}