使用 ASP.net/IIS 在本地主机中未显示 div 上的特定图像

发布于 2024-11-01 01:30:11 字数 4805 浏览 0 评论 0原文

当我在本地主机中运行它时出现问题,我的标题消失了,有时当我更改 #header 中的一些代码时,它出现在设计视图中,但是当在本地主机上运行时,它显示为大图像并且不遵循正确的图像我声明的高度和宽度。我将在此处粘贴的代码是未在设计视图和本地主机上显示的代码。

这是我的母版页代码:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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 id="Head1" runat="server">
    <title>Untitled Page</title>
    <link href="App_Themes/default/default.css" rel="stylesheet" type="text/css" runat="server" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <!--start of css div-->
    <div id="outer">

    <div id="upbg"></div>

    <div id="inner">

        <div id="header" runat="server">

        </div>

        <!--<div id="splash"></div>-->

        <div id="menu">
            <ul>
                <li class="first"><a href="Default.aspx">Home</a></li>
                <li><a href="#">Gallery</a></li>
                <li><a href="#">Links</a></li>
                <li><a href="About.aspx">About</a></li>
                <li><a href="Contact.aspx">Contact</a></li>
            </ul>

        <div id="Login"><asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>   </div>
        </div>

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
        <asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">

        </asp:ContentPlaceHolder>


        <div id="footer">

            &copy;Copyright © 2011 My Personal Werbsite. design by Migs Yandoc.

        </div>

    </div>

</div>


<!--end of css div-->


  </div>
    </form>
</body>
</html>

这是我的 css 代码:

*
{
padding: 0px;
margin: 0px;
    text-align: left;
}

body
{
background: #F9F9F7 url('images/a1.gif') repeat-x;
font-size: 11px;
font-family: "trebuchet ms", helvetica, sans-serif;
color: #8C8C73;
line-height: 18px;
}

a
{
color: #FF7800;
text-decoration: underline;
}

a:hover
{
text-decoration: none;
}

sup
{
font-size: 0.5em;
}


p
{
margin-bottom: 14px;
text-align: justify;
}

img.picA
{
position: relative;
top: -2px;
background: url('images/a47.gif') no-repeat;
width: 76px;
height: 74px;
padding: 8px;
}

img.picB
{
position: relative;
top: -2px;
background: url('images/a26.gif') no-repeat;
width: 146px;
height: 75px;
padding: 7px;
}

img.floatleft
{
float: left;
margin: 0px 14px 3px 0px;
}


ul.linklist
{
list-style: none;
}

ul.linklist li
{
border-top: solid 1px #EEEEEE;
padding-top: 5px;
margin: 5px 0px 0px 0px;
}

ul.linklist li.first
{
border-top: 0px;
margin-top: 0px;
padding-top: 0px;
}

#upbg
{
position: absolute;
top: 0px;
left: 0px;
background: #fff url('images/upbg.gif') no-repeat;
width: 747px;
height: 264px;
z-index: 1;
}

#outer
{
position: relative;
width: 747px;
margin: 0 auto;
background: #fff url('images/abg.gif') repeat-y;
}

#inner
{
position: relative;
padding: 13px 30px 13px 30px;
z-index: 2;
}

> #header {
>     background: url ("~/images/a99.gif") no-repeat;
>     position: absolute;
>     width: 202px;
>     height: 92px;
>     color: #fff;
>     padding-left: 20px;
>     top: 14px;
>     left: 32px;
>     visibility: visible; }



#header span
{
font-weight: normal;
}

#header h1
{
position: absolute;
font-size: 23px;
letter-spacing: -1px;
top: 30px;
height: 92px;
}

#header h2
{
position: absolute;
font-size: 10px;
font-weight: normal;
color: #FCE2CA;
top: 51px;
}

#header sup
{
color: #FCE2CA;
}

图像是 a99.gif!尺寸正确为 202x92px。

希望你能帮助我,因为我真的陷入了这一部分。

提前致谢。

肃然, 米奇队

Problem when i run it in localhost my header disappear, sometimes when i'm changing some code in #header it appears in design view but when run on localhost it's appearing as a big image and not following the correct height and width that i declare. the code that i will paste here is the one that is not showing either on design view and localhost.

Here is my Masterpage code:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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 id="Head1" runat="server">
    <title>Untitled Page</title>
    <link href="App_Themes/default/default.css" rel="stylesheet" type="text/css" runat="server" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <!--start of css div-->
    <div id="outer">

    <div id="upbg"></div>

    <div id="inner">

        <div id="header" runat="server">

        </div>

        <!--<div id="splash"></div>-->

        <div id="menu">
            <ul>
                <li class="first"><a href="Default.aspx">Home</a></li>
                <li><a href="#">Gallery</a></li>
                <li><a href="#">Links</a></li>
                <li><a href="About.aspx">About</a></li>
                <li><a href="Contact.aspx">Contact</a></li>
            </ul>

        <div id="Login"><asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>   </div>
        </div>

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
        <asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">

        </asp:ContentPlaceHolder>


        <div id="footer">

            ©Copyright © 2011 My Personal Werbsite. design by Migs Yandoc.

        </div>

    </div>

</div>


<!--end of css div-->


  </div>
    </form>
</body>
</html>

And here is my css code:

*
{
padding: 0px;
margin: 0px;
    text-align: left;
}

body
{
background: #F9F9F7 url('images/a1.gif') repeat-x;
font-size: 11px;
font-family: "trebuchet ms", helvetica, sans-serif;
color: #8C8C73;
line-height: 18px;
}

a
{
color: #FF7800;
text-decoration: underline;
}

a:hover
{
text-decoration: none;
}

sup
{
font-size: 0.5em;
}


p
{
margin-bottom: 14px;
text-align: justify;
}

img.picA
{
position: relative;
top: -2px;
background: url('images/a47.gif') no-repeat;
width: 76px;
height: 74px;
padding: 8px;
}

img.picB
{
position: relative;
top: -2px;
background: url('images/a26.gif') no-repeat;
width: 146px;
height: 75px;
padding: 7px;
}

img.floatleft
{
float: left;
margin: 0px 14px 3px 0px;
}


ul.linklist
{
list-style: none;
}

ul.linklist li
{
border-top: solid 1px #EEEEEE;
padding-top: 5px;
margin: 5px 0px 0px 0px;
}

ul.linklist li.first
{
border-top: 0px;
margin-top: 0px;
padding-top: 0px;
}

#upbg
{
position: absolute;
top: 0px;
left: 0px;
background: #fff url('images/upbg.gif') no-repeat;
width: 747px;
height: 264px;
z-index: 1;
}

#outer
{
position: relative;
width: 747px;
margin: 0 auto;
background: #fff url('images/abg.gif') repeat-y;
}

#inner
{
position: relative;
padding: 13px 30px 13px 30px;
z-index: 2;
}

> #header {
>     background: url ("~/images/a99.gif") no-repeat;
>     position: absolute;
>     width: 202px;
>     height: 92px;
>     color: #fff;
>     padding-left: 20px;
>     top: 14px;
>     left: 32px;
>     visibility: visible; }



#header span
{
font-weight: normal;
}

#header h1
{
position: absolute;
font-size: 23px;
letter-spacing: -1px;
top: 30px;
height: 92px;
}

#header h2
{
position: absolute;
font-size: 10px;
font-weight: normal;
color: #FCE2CA;
top: 51px;
}

#header sup
{
color: #FCE2CA;
}

The image is a99.gif! The size is right 202x92px.

Hope that you can help me cause I'm really stuck in this part.

Thanks in advance.

Respectfully yours,
Migs

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨小沫ゞ 2024-11-08 01:30:11

~ 未编译以提供正确的目录。

background: url ("~/images/a99.gif") no-repeat;

请将其更改为

background: url ("images/a99.gif") no-repeat;

如果您的页面位于根目录而不是子目录,

及其工作。 css文件是静态文件,不会被asp.net更改或编译。

The ~ is not compiled to give the correct directory.

background: url ("~/images/a99.gif") no-repeat;

change it to

background: url ("images/a99.gif") no-repeat;

and its work if you have pages on the root dir and not on subdirectories.

The css file is a static file, that not change or compiled by asp.net.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文