由于某些原因,我无法将注意力集中在CSS和HTML上。我试图在我的母版页中为HTML div显示图像。我正在使用Visual Studio,它们位于不同的文件中。
HTML:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="image" href="/css/masterCSS.css">
</div>
<form id="form1" runat="server">
<div>
<br />
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
CSS:
div.image {
content:url(http://i.imgur.com/6d3unPC.jpg)
}
档案:
我在div上尝试过runat =“ server”,它没有改变任何东西。
如果我完全理解您想要做什么,请尝试以下方式:
<div class="image">
<a href="/css/masterCSS.css">
<img src="insert path to your image">
</a>
</div>
这是一种确实需要CSS来广告内容的方法...以防万一您想以这种方式做到这一点,只需使用CSS并在我的HTML代码第3行中...
希望对您有所帮助:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句