Respuestas:
¿Te refieres a esto?
<style type="text/css">
.bgimg {
background-image: url('../images/divbg.png');
}
</style>
...
<div class="bgimg">
div with background
</div>
Puede hacerlo utilizando las backgroundpropiedades de CSS . Hay pocas formas de hacerlo:
HTML:
<div id="div-with-bg"></div>
CSS :
#div-with-bg
{
background: color url('path') others;
}
HTML:
<div class="div-with-bg"></div>
CSS :
.div-with-bg
{
background: color url('path') others;
}
HTML:
<div style="background: color url('path')"></div>
Donde :
background La propiedad CSS es una conexión de todas las propiedades de background-xxx en esa sintaxis:
background : background-color background-image background-repeat background-adjunto background-position ;
Fuente: w3schools
Usar como ...
<div style="background-image: url(../images/test-background.gif); height: 200px; width: 400px; border: 1px solid black;">Example of a DIV element with a background image:</div>
<div style="background-image: url(../images/test-background.gif); height: 200px; width: 400px; border: 1px solid black;"> </div>
Simplemente puede agregar un atributo img src con id:
<body>
<img id="backgroundimage" src="bgimage.jpg" border="0" alt="">
</body>
y en su archivo CSS (estirar el fondo):
#backgroundimage
{
height: auto;
left: 0;
margin: 0;
min-height: 100%;
min-width: 674px;
padding: 0;
position: fixed;
top: 0;
width: 100%;
z-index: -1;
}
<div class="foo">Foo Bar</div>
y en tu archivo CSS:
.foo {
background-image: url("images/foo.png");
}
<div id="imgg">Example to have Background Image</div>
Necesitamos agregar el siguiente contenido en la etiqueta Estilo:
.imgg(
background-image: url('C:\Users\ajai\Desktop\10.jpg');
)
En su mayor parte, el método es el mismo que configurar todo el cuerpo
.divi{
background-image: url('path');
}
</style>
<div class="divi"></div>