-5
<html>
    <head>
    <link href="styles/main.css" type="text/css"
    rel="stylesheet" media="screen"/>


    </head>
    <body>
    <div id="wrapper">
    <?php include_once("forall.php");?>
    <?php include_once("template_nav.php"); ?>

    <div id="content"></div>


    <div id="footer">abcd</div>
    </div>
    </body>
    </html>

我的CSS代码:

*
{
margin:0px;
padding:0px;
}



 body
    {
        font-family: verdana;
        background-image: url(http://local host/Website/imagess/sp.jpg);

    }


#wrapper
{
    width: 1024px;
    margin-left: 120px;
    background-color: #ebebeb;
}
#header
{
height:200px;

}

.logo
{
    margin-top: 50px;
    float: left;

height::200px;
    background-image: url(http://local host/Website/imagess/sur99.jpg);


}

#searchbox
{
float:right;
margin-top:100px;

}

#nav{

    clear: both;
height:50px;
    margin-left: 30px;
        background-image: url(http://local host/Website/imagess/s4.jpg);
}
ul#navmenu,ul.submenu1
{
list-style-type:none;
}
ul#navmenu li
{
width:123px;
text-align:center;
position:relative;
float:left;
margin-right:4px;
padding:5px;

}

ul#navmenu a{
text-decoration:none;
display:block;
width:123px;
height:30px;
line-height:30px;

border-radius:5px;
color:white;
font-weight:bold;
margin-top:10px;

}

ul#navmenu .submenu1 a
{
margin-top:3px;
}

ul#navmenu li a:hover
{
background-color:black;
}

ul#navmenu ul.submenu1
{
display:none;
position:absolute;

}

ul#navmenu li:hover .submenu1
{
display:block;
}

.darrow
{
font-size:11pt; 
position:absolute;

top:21px;
right:16px;
color:white;
}


#footer
{
width:1024;
background-color:#696969;

}

包含文件“forall.php:

<div id="header">
<div class="logo">

</div>
<div id="searchbox">
<form id="searching">
<input type="text" name="forsearch">
<input type="button" name="search" 

value="search">
</form>
</div>
</div>

我已将根目录从 localhost/ 更改为“localhost/Website”,因为当我在 WAMP 中运行我的页面时,我的索引文件和图像(在 imagess 文件夹中)位于 wamp/www/Website 的网站文件夹中,图像不显示。替代文字可见,但图像不可见。请帮助

4

1 回答 1

3

在您的 CSS 更改中

background-image: url(http://local host/Website/imagess/sp.jpg);

background-image: url(http://localhost/Website/imagess/sp.jpg);

同样适用于所有背景图像。您在 url 的 localhost 中有一个空格。

于 2013-06-12T22:59:08.783 回答