var width = document.documentElement.clientWidth,
height = width / 3,
bg = $('.views-field-nothing').find('.views').html();
bg = "url('" +bg+ "')";
//$(".views-field-nothing").attr("<img src=", bg);
$(".views-field-nothing").css('background', bg);
$(".views-field-nothing").css('height', height);
$(".views-field-nothing").css('width', width);
.views-field-nothing {
border: 1px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<div class="views-field-nothing">
<div class="views">http://goodimg.ru/img/tsvetochek-risunok3.jpg</div>
</div>
<div class="views-field-nothing">
<div class="views">http://agu-shop.ru/images/pink_flower_512x512.png</div>
</div>
<div class="views-field-nothing">
<div class="views">http://www.raskraska.ru/counting/flower-bw.gif</div>
</div> |