-1

現在、ウェブサイトの背景に画像を設定しようとしていますが、テストのためにローカルホストを使用していますが、設定できません。index.html と同じファイルに画像を配置します。名前もコード「background2.jpg」と同じです。

これはcssファイルの私のコードです:

body
{
background:url("background2.jpg") no-repeat center center   fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
user-select: none;
-moz-user-select: none;
overflow: hidden;   
}
4

4 に答える 4

1

同じフォルダーにあるcssと私の画像を使用してindex.htmlを作成しましたが、動作します。Web サーバーの設定に問題がある可能性があります。

于 2013-10-03T10:08:04.827 に答える
-1

あなたはこれを必要とします

body{
height:100%;
width:100%;
}

これを試して..

于 2013-10-03T10:05:22.533 に答える
-2

これを試して:

body
{
width: 100%;
height: 100%;
background:url("background2.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
user-select: none;
-moz-user-select: none;
overflow: hidden;   
}
于 2013-10-03T10:05:59.410 に答える