如何将静态图像添加到表

小二郎

我想在桌子的右上方显示一个静态图像。当我尝试添加这样的CSS代码时,它失败了:

<style>
    .hoverTable{background:url(../../Images/taxi.jpg) top right no-repeat;
            background-attachment:fixed; }
</style>

但这有效:

<style>
    body {background:url(../../Images/taxi.jpg) top right no-repeat;
            background-attachment:fixed; }
</style>

我的桌子是这样的:

 <table class="hoverTable">

            @for (int i = 0; i < Model.Questions.Count; i++)
            {
                <tr>
                    <td>
                        @Model.Question[i]
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.Answers[i].Answer, new { @style = "width:20px; margin-left:10px; margin-bottom:10px; text-align:center;" })

                    </td>

                </tr>
            }
        </table>

那么如何添加如下所示的图片呢?

在此处输入图片说明

比拉勒·马格苏德(Bilal Maqsood)

尝试这个

 .hoverTable{
    background:url(../../Images/taxi.jpg) top right no-repeat;
    background-attachment:fixed;
    background-size: 100% 100%;
    width:100%;
  }

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章