Bonjour,
Je suis débutante en site internet et j'ai fais une page internet avec juste une image en fond. Je voudrais qu'elle s'adapte en fonction de la résolution d'un écran. J'ai essayé du CSS et intégré un script Javascript pour que en fonction de la résolution, une image précise s'affiche. IL s'agit de la même image mais enregistrer sous plusieurs resolutions.
MAis rien ne fonctionne. L'image s'afiche mais elle n'est pas centrée et elle se trouve en haut à gauche de l'écran.
Merci d'avance pour votre aide

Je vous joins le code pour montrer ce que j'ai deja fait

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Accueil</title>
			<style type="text/css">
                                BODY 
                                        {
                                                margin: 0;
                                                padding: 0;
                                                background-color:#000000;
                                                background-image:url('pictures/home/home.jpg');
                                                background-attachment:fixed;/* je rends cette partie fixe */ 
                                                background-repeat:no-repeat;
                                                position: fixed;
                                                top: 0;
                                                left: 0;
                                                width: 100%;
                                                height: 100%;           
                                        }
                        </style>
</head>
 
<script type="text/javascript">
   if (screen.width==800&&screen.height==600) 
    {
        document.write("<body background="pictures/home/home_600_800.jpg\">");
    }
    else 
    if (screen.width==1024&&screen.height==768) 
    {
        document.write("<body background="pictures/home/home_1024_768.jpg\">");
    }
    else
    if (screen.width==1280&&screen.height==1024) 
    {
         document.write("<body background="pictures/home/home_1280_1024.jpg\">");
    } 
    else
    if (screen.width==1600&&screen.height==1200)
    {
         document.write("<body background="pictures/home/home_1600_1200.jpg\">");
    }
   else  document.write("<body background="fondAcceuil_si_rien_ne_correspond.jpg\">"); 
 </script>
 
<body>
 
 
</body>
</html>