如何将文本放在数据库中出现的图片上?

时间:2018-01-18 20:03:41

标签: html css asp.net twitter-bootstrap

我使用bootstrap,我的照片在我的行和列中,但是我找不到在这张照片上放置文字的方法。有没有办法让这成为可能呢?

<div class="container-fluid">
@foreach (Item items in Model.Items)
{
    <div class="row">
        <div class="col-md-12 text-center">
                <img src="~/images/@Html.DisplayFor(modelItem => items.Picture)" />
        </div> 
    </div>
}

1 个答案:

答案 0 :(得分:0)

在css中试试这个

.row {
 background-image: url("~/images/@Html.DisplayFor(modelItem => items.Picture)");
}

或类似的东西:

   <div class="container-fluid">
       @foreach (Item items in Model.Items)
     {
    <div class="row" style=background-image:url("~/images/@Html.DisplayFor (modelItem => items.Picture)">
        <div class="col-md-12 text-center">
                <img src="~/images/@Html.DisplayFor(modelItem => items.Picture)" />
        </div> 
    </div>
     }