Partage
  • Partager sur Facebook
  • Partager sur Twitter

Background-image qui n'affiche rien

    15 novembre 2019 à 19:18:18

    Bonjour tout le monde,

    Comme dit dans le titre je cherche à mettre une image en fond pour mon site et y superposer du texte cependant elle ne veut pas s'afficher, j'ai regardé plusieurs sites pour comprendre l'usage de cette balise pour voir si je ne m'étais pas trompé mais je ne comprends pas pourquoi elle s'affiche pas, j'ai donc besoin d'aide :)

    Voici mon HTML:

    <!DOCTYPE html>
    <html lang="fr">
    <head>
         <meta charset="utf-8"/>
    	 <title>Le Portefolio de Paris Émilien</title>
    	 <link href="./style.css" rel="stylesheet" type="text/css"/>
    </head>
    
    <body>
    <header> 
    	    <nav>
    		     <ul>
    		         <li><a href="./index.html">PARIS Émilien</a></li>
    				 <li><a href="#">Qui-suis-je ?</a></li>
    				 <li><a href="#">Mes Compétences</a></li>
    	             <li><a href="./pages/réalisations.html">Mes Réalisations</a></li>
    	             <li><a href="./pages/contact.html">Me Contacter</a></li>
    			</ul>
    		</nav>
    </header>
    <main>
    <article>
    	 <div style="display:inline-block">
    		<img src="./images/Photo_de_profil_Émilien_Paris.jpg" alt="La photo de profil de PAris Émilien"/>
    	 </div>
    	 <div style="display:inline-block;vertical-align:top;margin-top:50px;">
    		<h1>Paris Émilien</h1>
    		<p>« Le montage c'est le moment où notre imagination prend forme »</p> 
    	 </div>
    </article>
    <article>
    	 <a href="#competences"><img src="./images/vers le bas.jpg"/></a>
    </article style="display:inline-block;">
    	<div>
    		<div style="text-align:center">
    		<h1 id="competences"> Mes Compétences </h1>
    	</div>
    	</div>
    </main>
    
    <footer>
         <p><a href="./documents/CV-MMI.pdf" target="_blank">Mon CV téléchargeable</a></p>
    </footer>
    
    </body>
    </html>

    Et mon CSS :

    *
    {   margin-top:0px;
    	margin-left:0px;
    	margin-right:0px;
    	margin-bottom:0px;
    }
    nav{
    	height:65px;
    	background-color:black;
    	border-bottom:1px solid white;
    }
    nav ul li
    {	display:inline;
    	line-height:65px
    }
    nav ul li a
    {	text-transform:uppercase;
    	font-family: Arial, sans serif;
    	font-weight:bold;
    	text-decoration:none;
    	color:gray;
    	border-radius:5%;
    	margin-right:50px;
    }
    nav ul li:first-child a
    {   color:white;
    }
    nav ul li a:hover
    {	color:orange;
    }
    article:first-child
    {   background-color:black;
    	margin:50px 10px;
    	height: 350px
    }
    article > div:nth-child(even)
    {   background-color:white;
    	padding:10px;
    	width:950px;
    	height:125px;
    	-webkit-transform:skew(10deg);
    	-moz-transform:skew(10deg);
    	-o-transform:skew(10deg);
    	transform:skew(10deg)
    }
    article > div > img
    {   border-radius:50%;
    	transform: rotate(90deg);
    	height:300px;
    	width:300px;
    	padding:25px;
    	display:inline-block;
    }
    article > div > h1
    {   font-family:FreeMono, monospace;
    	font-weight:bold;
    	font-size:30px;
    }
    article > div > p
    {   font-family:Courier New, monospace;
    	font-size:30px;
    	color:light-gray;
    }
    article:nth-child(even)
    {   text-align:center;
    }
    article:nth-child(2) > a >img
    {   height:50px;
    	width:50px;
    	border-radius:50%;
    	border:1px solid black;
    	margin-top:140px;
    }
    article:last-child
    {   background-image:url("images/planetes.gif");
    }
    footer
    {   background-color:black;
    	height:100px;
    	text-align:center;
    	line-height:100px;
    }
    footer > p > a
    {   font-family:Arial, sans serif;
    	font-size:15px;
    	text-decoration:none;
    	color:white;
    }
    

    Merci d'avance pour votre aide ! :)


    • Partager sur Facebook
    • Partager sur Twitter
      16 novembre 2019 à 9:06:42

      Bonjour,

      beaucoup d'erreurs graves dans les codes, il serait fastidieux de les énumérer,  il faut impérativement passer le HTML et le CSS aux validateurs

      https://validator.w3.org/

      https://jigsaw.w3.org/css-validator/

      D'autre part, il n'y a aucune image en background dans le code CSS, donc normal qu'aucune image apparaisse en fond...

      un peu de doc :

      https://www.w3schools.com/cssref/pr_background-image.asp

      https://www.w3schools.com/cssref/css3_pr_background-size.asp

      voilà tu as toutes les infos pour mettre une image en background, mais d'abord : correction du code

      • Partager sur Facebook
      • Partager sur Twitter

      Background-image qui n'affiche rien

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown