'Can not add background image
I am trying to provide the background image to a div. Image is in my directory
<div style="background-image: url('H9Vi61CWym0.jpg');"></div>
but i see
<div style="background: url();">
Solution 1:[1]
It would be best if you tried to put the background-image
on CSS file because using inline CSS is much harder to maintain. You should try this:
1 - create a class
for your div I'll call it myDiv
like this:
<div class="myDiv"> your content </div>
2 - Then put something like this on CSS file:
.myDiv{
background-image: url('H9Vi61CWym0.jpg');
}
Or if you want you can put it on <style>
element inside the <head>
element like this:
<style>
.myDiv{
background-image: url('H9Vi61CWym0.jpg');
}
</style>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bernardo Almeida |