-1
How do I put a background image on div
, using css?
I tried using simple quotes but nothing happened:
background: url('images/html.jpg');
I’m doing so in the:
#tudo { width: 100%; height: 992px; background: url('images/html.jpg');}
-1
How do I put a background image on div
, using css?
I tried using simple quotes but nothing happened:
background: url('images/html.jpg');
I’m doing so in the:
#tudo { width: 100%; height: 992px; background: url('images/html.jpg');}
1
Try it this way:
<div style="background-image:url(images/html.jpg)">Conteúdo da div</div>
or
#tudo{
background-image:url(images/html.jpg);
width:100%;
height:992px;
}
<div id="tudo">Conteúdo da div</div>
Thanks helped a lot!! Thanks I am new here and I will participate several times!!
Since his answer worked you should give it as right by clicking on the correct symbol just below the score.
Junior how can I sure as hell not found what you talked about the symbol!
@Themax On the left side << Below the arrow
1
For this there are 2 probable reasons:
The 1° can be solved by accessing the image if it exists so you did not include the CSS in the file try to replace the file code with the following:
<style>
#tudo {
width: 100%;
height: 992px;
background-image: url(images/html.jpg);
}
</style>
<div id="tudo"></div>
As you can see through of this link the code works.
Browser other questions tagged html css
You are not signed in. Login or sign up in order to post.
Take a look here: http://jsfiddle.net/XmTVT/ - is sure that the file
images/html.jpg
exists in the directory that indicated?– Sergio
I’m still wanting to understand what the problem and how it was solved if the user’s answer below is equal to the code you presented.
– Paulo
Hi Paulo I was not able to link the background with html and css, for some reason it was not working but I used the option calling Stylo inside the DIV as it was informed above, so I was able to do what I wanted. That’s why my doubt was solved. Thank you all.
– TheMax
@Themax putting style inside the div is not a best practice, CSS should always be separate from HTML.
– Paulo