gpt4 book ai didi

css - 将图像附加到 MVC 4 中的 ActionLink

转载 作者:技术小花猫 更新时间:2023-10-29 11:45:59 25 4
gpt4 key购买 nike

我在 MVC 4 应用程序中使用带有 id 的 ActionLink 并在 css 中为 actionLink id 分配图像,但实际上我做错了。不管用!这是我的代码

 <div class="logo_container">
@Html.ActionLink(" ", "Index", "Home", null, new { id = "_Logo" })
</div>

CSS

.logo_container {
width:339px;
height:116px;
}

#_Logo {
background-image: url("../Images/logo.png");
width:339px;
height:116px;
background-color:green;
}

最佳答案

这是我的应用程序。工作正常:

.logo{
background:no-repeat url(/Content/photo/png/sprite.png) 0 0;
height:15px;
width:20px;
overflow:hidden;
float:left;
border:none;
display:inline;
}

<a href="@Url.Action("Action", "Controller")" class="logo"></a>

关于css - 将图像附加到 MVC 4 中的 ActionLink,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19245343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com