Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在div中显示图像_Asp.net_Css - Fatal编程技术网

Asp.net 在div中显示图像

Asp.net 在div中显示图像,asp.net,css,Asp.net,Css,在div元素中显示图像时遇到问题 div中有一个自定义web控件(登录控件) 致以最诚挚的问候。我在您的页面上没有看到“divLog”的ID。。只是“登录”而已。。这可能是问题所在吗?将位置更改为相对位置,并将登录内容放在image div中。同时更新相对位置的顶部和左侧 只是想一想。确保图像路径是相对于css文件的,而不是相对于aspx文件的。在这里粘贴代码时,这是一个典型的例子,它在我的代码中被正确命名。 <%@ Page Language="C#" AutoEventWireu

在div元素中显示图像时遇到问题

div中有一个自定义web控件(登录控件)


致以最诚挚的问候。

我在您的页面上没有看到“divLog”的ID。。只是“登录”而已。。这可能是问题所在吗?

将位置更改为相对位置,并将登录内容放在image div中。同时更新相对位置的顶部和左侧


只是想一想。

确保图像路径是相对于css文件的,而不是相对于aspx文件的。在这里粘贴代码时,这是一个典型的例子,它在我的代码中被正确命名。
   <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Theme="Styles" %>
<%@ Register src="wucLogin.ascx" tagname="wucLogin" tagprefix="log" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Login</title>
    <link rel="Stylesheet" type="text/css" href="App_Themes/Styles/LoginStyleSheet.css" />
</head>
<body>
    <form id="form1" runat="server">
        <div id="divLogin">

        <log:wucLogin id="WebUserControlLogin" runat="server" />         
        </div>
    </form>
</body>
</html>
#divLogin
{
    background-image: url('../Images/test2.png');
    background-repeat: no-repeat;
    background-position:center;

    position: absolute;
    text-align: center;

    top: 40%;
    left: 52.8%;
    width: 401px;
    height: 123px;
    margin-top: -61,5px;
    margin-left: -250px;
}