移动背景图像移动

时间:2015-08-14 18:43:41

标签: html css mobile

我的移动背景图片正在移动。在每个页面中它都有不同的位置。

我的css代码:

body {

    background-image: url('/IMG/city.jpg') center center cover no-repeat fixed;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;

}

还试过这个:

@media only screen and (max-width: 767px) {
  body {
    /* The file size of this background image is 93% smaller
       to improve page load speed on mobile internet connections */
    background-image: url(/IMG/mobile_background.bmp);
  }
}

我也把它放在我的HTML文件中

<head>
        <title>My name/title>
        <link rel="stylesheet" href="/CSS/style.css">

        <link rel="shortcut icon" href="/IMG/favicon.ico"/>


        <link rel="stylesheet" type="text/css" media="only screen and (max-width: 480px), only screen and (max-device-width: 480px)" href="/mobile.css" />
        <!-- Viewport is voor mobile devices --> 
        <meta name="viewport" content="width=device-width">
        <meta name="viewport" content="width=device-width, initial-scale=1">


        <meta charset="utf-8" /> 

    </head>

这里有什么问题?

0 个答案:

没有答案