<style type="text/css>
body {background: url(imagen.jpg);}
</style>
Ejemplo similiar:
<body style="background: url(imagen.jpg)">
Para que la imagen no se
deslice hay que utilizar:
background-attachment: fixed;
/*La imagen se queda fijada en el fondo*/
La imagen de la pagina se repite tanto
horizontalmente como verticalmente.
background-repeat: repeat;
Cuando la imagen es mas
pequeña que el fondo,
la imagen
se repite varias veces.
Para que no se repita se emplea el codigo:
background-repeat: no-repeat;
La imagen se repite horizontalmente.
background-repeat: repeat-x;
La imagen se repite verticalmente.
background-repeat: repeat-y;
Ejemplo de una imagen de fondo
que se repite verticalmente:
<style>
body {background-image: url(image.gif);
background-repeat: repeat-y;}
</style>
Ejemplo de un fondo con imagen fija.
<style type="text/css>
BODY { background: white url(fondo.gif);
</style>
Otro ejemplo con imagen fija:
<style type="text/css>
body {background-image: url(image.jpg);
background-repeat: no-repeat;}
</style>
Si quitamos el BODY y ponemos
cualquier etiqueta se insertara un
fondo/imagen en donde la activemos.
Ejemplo con la etiqueta <DIV>
<HTML><HEAD>
<TITLE> CSS </TITLE>
<STYLE type="text/css>
DIV
{background-image: url(image.jpg);
background-repeat: no-repeat;
height: 200; width: 200}
</STYLE>
</HEAD> <BODY>
<DIV>
Activa el codigo con la imagen </DIV>
</HTML></BODY>
Ejemplo completo de una pagina:
<HTML><HEAD> <TITLE>Ejemplo</TITLE>
<STYLE>
BODY { background: /*imagen del fondo*/
url("http://www.yo.com/images/foto.jpg"); }
#CABECERA{ background: /*imagen de cabecera*/
url("http://www.yo.com/images/image.jpg")
no-repeat bottom center; }
#PAGINA { background: /*imagen del cuerpo*/
url("http://www.yo.com/images/image.jpg")
repeat-y top; border: none; }
#PIE { background: /*imagen del pie*/
url("http://www.yo.com/images/image.jpg")
no-repeat bottom; border: none;}
</STYLE> </HEAD> <BODY>
<CENTER>
<DIV ID=CABECERA>
<P>Aqui va el texto de la cabecera</P>
</DIV>
<DIV ID=PAGINA>
<P> Aqui va el texto de la pagina</P>
</DIV>
<DIV ID=PIE>
<P>Aqui va el texto del pie (abajo)</P>
</DIV> </HTML> </BODY>