背景图像不出现在CSS中

时间:2014-08-07 02:05:09

标签: html css

我的CSS背景没有显示出来。

网站:http://www.minecraftmore.site50.net/

代码:

<html>

      <head>

        <title>Minecraft More | Everything You Need To Know About Minecraft</title>

        <style>

        body {
            background-image: url(http://minecraftbuilder.com/wp-content/uploads/2013/07/background.jpg/)
            background-position: left top;
            background-repeat: no-repeat;
            background-size: contain;
            cursor: url(Images/Cursors/PrecisionSelect.ico), pointer;
        }

    </style>
    <style type="text/css"></style>

  </head>

  <body>
  <!-- Share Button START -->
    <a class="a2a_dd" href="http://www.addtoany.com/share_save">
    <img src="http://static.addtoany.com/buttons/share_save_171_16.png" border="0" alt="Share"/>
    </a>

    <script type="text/javascript">
    var a2a_config = a2a_config || {};

    a2a_config = {
        linkname: 'Share Minecraft More',
        linkurl: 'http://www.planetminecraft.com',
        num_services: 20,
        show_title: 1,
        onclick: true
    };

    a2a_config.custom_services = [
        ["Planet Minecraft",
            "http://www.planetminecraft.com/blog/minecraft-more/",
            "http://g.etfv.co/http://planetminecraft.com"
        ]
    ];
    </script>

    <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
    <!-- Share Button END -->

    <script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"></script>

    <script>
        alert("Minecraft More is a website created by GalgoR12 that has a ton of information on Minecraft. Scroll over the bold face words to view abbreviation meanings and word definitions.");

        var password = prompt("If you have received a special access code, enter it now for special content and information.");

        if (password == "") {
            alert("Here is your special information:\n\nGalgoR12 (Site Creator) has a server. The IP of the server is GalgoR12.zapto.org");
        } else {
            sorrymessage = "Sorry, you either didn't enter a correct code or didn't enter anything. Have fun on the site!";
            alert(sorrymessage);
        }
    </script>

    <p>
        <i>Minecraft</i> is sort of an <abbr title="Massive Multiplayer Online Role Playing Game"><b>MMORPG</b></abbr> where you have to find materials and build to survive the monsters that hunt you in the night. But there is a twist to it.
        It's also a <b title="A sandbox game is where you are given materials and the object of the game is to build things.">sandbox</b> game, as it has a gamemode called "creative," where you can grab materials and build whatever
        you want. It is constantly being updated and added to. Minecraft is a game for the computer, but is also on the XBox, the PS3, and the iPad and Android devices.
    </p>
    <p>Minecraft was originally an <b title="An individual game, often referred to as an indie game, is a game that is created by a single person or small group, and has not been published by a professional publisher.">indie game</b>
        released by Swedish programmer Markus &quot;Notch&quot; Persson in 2009, later being published and further developed by Mojang, finally having a full version released in 2011.
    </p>

    <p id="isip"></p>

    </body>

</html>

此代码的css根据其他网站和其他帖子是正确的,但它仍然没有出现。有人帮帮我吗?

2 个答案:

答案 0 :(得分:0)

以下是我使用W3C CSS Validator生成的错误代码 值错误:background-image尝试在属性名称前查找分号。加上它 你应该添加一个&#39;类型&#39;属性值为&#39; text / css&#39;这种风格&#39;元件

将body元素更改为此。

<style type="text/css">
body {
    background-image:url(http://minecraftbuilder.com/wp-content/uploads/2013/07/background.jpg);
    background-position: left top;
    background-repeat: no-repeat;
    background-size: contain;
    cursor: url(Images/Cursors/PrecisionSelect.ico), pointer;
    }
</style>

答案 1 :(得分:-1)

您的图片路径有不必要的反斜杠。