0
<style>  
background-image: url(".....");  
</style>    

The background tends to be blank when I use this snippet.Is there any other way to get background image for my page ?.

Ousmane D.
  • 54,915
  • 8
  • 91
  • 126
Thenmozhi
  • 1
  • 2

4 Answers4

0

The background tends to be blank when i use this snippet

  1. That's because you haven't specified the tag in which you want to apply the background image to.
  2. you haven't specified a valid path to the image.

Simply do something like below but of course replace the URL with your own:

body {
    background-image: url("paper.gif");
}
Ousmane D.
  • 54,915
  • 8
  • 91
  • 126
0

You need to specify which element you want to give the background.

Either you give the element a class or a id or something like body.

.class {
    background-image: url("http://icons.veryicon.com/ico/System/Icons8%20Metro%20Style/Logos%20Wikipedia.ico");
}

#id {
    background-image: url("http://icons.veryicon.com/ico/System/Icons8%20Metro%20Style/Logos%20Wikipedia.ico");
}

body {
    background-image: url("https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png");
}
<div id="id">Test1</div>
<div class="class">Test2</div>
Patrick Mlr
  • 2,955
  • 2
  • 16
  • 25
0

Also you can write it inline

<body style="background-image: url('img/bg.jpg')">
pacanga
  • 416
  • 6
  • 17
0
  1. You need to specify the tag, class, or id you want the background-image to be in. Example

    body, .class, #id { background-image: url("img.png"); }

or inline-style

<div style="background-image: url('something.gif')"></div>
  1. You also need to be sure of the image path of the image you want to put

for instance if image is in the same folder as css or html say

body {
    background-image: url("image.png");
}

if in a folder outside the css folder

body {
    background-image: url("../foldername/image.png");
}

and so on

Oke Tega
  • 850
  • 10
  • 21