无法插入背景图片html / css

时间:2014-03-28 10:05:59

标签: html css

我在向我的网站插入背景时遇到问题。

我使用这种css格式:

<body background='imgs/papBG.png' bgproperties='fixed'>
    <img src="Imgs/banner.png" width="100%">
    <div id='cssmenu'>
        <ul>
            <li class='active'><a href='index.html'><span>Página Inicial</span></a></li>
            <li><a href='#'><span>Shows</span></a></li>
            <li><a href='#'><span>Blog</span></a></li>
            <li><a href='#'><span>Loja do Fã</span></a></li>
            <li><a href='#'><span>Perguntas Frequentes</span></a></li>
        </ul>
    </div>
    <div id='budy'>
        <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    </div>

#budy {
        width:1000px;
        margin-left:auto;
        margin-right:auto;
        border-left-style:solid;
        border-right-style:solid;
        border-width:3px;
        background-image: url('imgs/budyBG.png'); /* add quotes, still not working */
        border-bottom-style:solid;
        font-family: Corbel;
        border-bottom-right-radius: 15px;
        border-bottom-left-radius: 15px;
        background-repeat:repeat; /* edited, still not working */
    }

这就是结果,我无法找到原因......

http://i.imgur.com/2eEk5d9.jpg

或者这是某种错误,或者我是盲目的,无法看到我错误的地方。

编辑:添加了更多代码,以便您可以更好地了解网站

4 个答案:

答案 0 :(得分:0)

请检查以确保您的背景图片已加载。有时候我写了错误的图片网址,看起来就是这样。

答案 1 :(得分:0)

您应该将背景设置为正文本身,以获得与附加图片中相同的结果

body{
    margin:0;    
    background-image: url(imgs/budyBG.png);
    border-bottom-style:solid;
    background-repeat:repeat-y;
    background-repeat:repeat-x;
}

答案 2 :(得分:0)

<!doctype html>
<html>
<head>
    <style>
        body {
            width:1000px;
            height:400px; /* Leave out the <br>'s */
            margin:0 auto;
            border:3px solid #000;
            border-top:0;
            background-image:url('imgs/budyBG.png');
            background-repeat:repeat
            font-family:'Corbel';
            border-radius:0 0 15px 15px;
        }
    </style>
</head>
<body>

</body>
</html>

答案 3 :(得分:0)

试试这个:

#budy {
        width:1000px;
        margin-left:auto;
        margin-right:auto;
        border-left-style:solid;
        border-right-style:solid;
        border-width:3px;
        background-image:url("img_tree.png");
        background-repeat:no-repeat;
        border-bottom-style:solid;
        font-family: Corbel;
        border-bottom-right-radius: 15px;
        border-bottom-left-radius: 15px;
        background-repeat: repeat;
    }