How do I put a background image on div
, using css?
I tried using single quotes but nothing happened:
background: url('images/html.jpg');
I'm doing so on:
#tudo { width: 100%; height: 992px; background: url('images/html.jpg');}
How do I put a background image on div
, using css?
I tried using single quotes but nothing happened:
background: url('images/html.jpg');
I'm doing so on:
#tudo { width: 100%; height: 992px; background: url('images/html.jpg');}
Try this:
<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>
For this there are 2 probable reasons:
The 1st can be solved by accessing the image if it exists so you did not include the CSS in the file try replacing 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 this link the code works.