2017-02-15 5 views
0

J'ai reçu des commentaires à propos d'une affectation passée qui m'avertissait que mes images étaient floues. Mais je ne peux pas comprendre comment le réparer. Le devoir donne des descriptions très claires de ce qu'il faut faire mais j'ai fait tout ce qu'il a demandé.Comment réparer une image floue lorsqu'elle est rendue avec CSS?

je dois faire ce qui suit pour les images:

Ajouter un nouvel identifiant de sélection nommé yurthero. Dans les déclarations de code CSS pour configurer la hauteur 300px et afficher l'image d'arrière-plan coast.jpg pour remplir l'espace (utiliser background-size: 100% 100%;) sans répéter.

Comment puis-je empêcher mon image d'être floue? Il me semble que l'étirement l'oblige à se brouiller.

Ci-dessous est le html5, le css3, et l'image que j'utilise. coast.jpg

/* pacific.css for assignment #3 by Caleb Latimer */ 
 
body{ 
 
     background-color: #FFFFFF; 
 
     color : #666666; 
 
     font-family: Verdana; 
 
     background-image: url(background.jpg); 
 
} 
 
h1{ 
 
     background-color: #000033; 
 
     color : #FFFFFF; 
 
     font-family: Georgia; 
 
     line-height: 200%; 
 
     background-image: url(sunset.jpg); 
 
     background-repeat: no-repeat; 
 
     padding-left: 20px; 
 
     height: 72px; 
 
     margin-bottom: 0; 
 
     background-position: right; 
 
} 
 
nav{ 
 
     font-weight: bold; 
 
     background-color: #90C7E3; 
 
     padding: 5px 5px 5px 5px; 
 
} 
 
h2{ 
 
     color: #3399CC; 
 
     font-family: Georgia; 
 
} 
 
dt{ 
 
     color: #000033; 
 
     font-weight: bold; 
 
} 
 
.resort{ 
 
     color: #000033; 
 
     font-size: 1.2em; 
 
} 
 
footer{ 
 
     font-size: .70em; 
 
     font-style: italic; 
 
     text-align: center; 
 
     padding: 10px 10px 10px 10px; 
 
} 
 
#wrapper{ 
 
     width: 80%; 
 
     margin-right: auto; 
 
     margin-left: auto; 
 
     background-color: #ffffff; 
 
     min-width: 700px; 
 
     max-width: 1024px; 
 
     box-shadow: 5px 5px 5px #828282; 
 
} 
 
h3{ 
 
     color: #000033; 
 
} 
 
main{ 
 
     padding-left: 20px; 
 
     padding-right: 20px; 
 
     display:block; 
 
} 
 
#homehero{ 
 
     background-size: 100% 100%; 
 
     height: 300px; 
 
     background-image: url(coast.jpg); 
 
     background-repeat: no-repeat; 
 
} 
 
#yurthero{ 
 
     height: 300px; 
 
     background-image: url(yurt.jpg); 
 
     background-size: 100% 100%; 
 
     background-repeat: no-repeat; 
 
} 
 
#trailhero{ 
 
     height: 300px; 
 
     background-image: url(trail.jpg); 
 
     background-size: 100% 100%; 
 
     background-repeat: no-repeat; 
 
} 
 
nav a{ 
 
     text-decoration: none; 
 
}
<!-- Chapter 4 Homework by Caleb Latimer --> 
 
<!DOCTYPE html> 
 
<html lang="en"> 
 

 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>Pacific Trails Resort</title> 
 
    <link rel="stylesheet" href="pacific.css" /> <!-- Uses the pacific.css stylesheet inside of folder --> 
 
    </head> 
 
    <body> 
 
     <div id="wrapper"> 
 
      <header> 
 
        <h1>Pacific Trails Resort</h1> 
 
      </header> 
 

 
      <nav> 
 
      <a href="index.html">Home</a> 
 
      &nbsp; 
 
      <a href="yurts.html">Yurts</a> 
 
      &nbsp; 
 
      <a href="activities.html">Activities</a> 
 
      &nbsp; 
 
      <a href="reservations.html">Reservations</a> <!-- Doesn't lead anywhere no requirements given --> 
 
      </nav> 
 

 
      <div id ="homehero"></div> 
 
      <main> 
 
      <h2>Enjoy Nature in Luxury</h2> 
 

 
      <p> 
 
       <span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast. Relax in serenity with panoramic views of the Pacific Ocean. 
 
      </p> 
 

 
      <ul> 
 
       <li>Private yurts with decks overlooking the ocean</li> 
 
       <li>Activities lodge with fireplace and gift shop</li> 
 
       <li>Nightly fine dining at the Overlook Cafe</li> 
 
       <li>Heated outdoor pool and whirlpool</li> 
 
       <li>Guided hiking tours of the redwoods</li> 
 
      </ul> 
 

 
      <div> 
 
       <span class="resort">Pacific Trails Resort</span> <br /> 
 
       12010 Pacific Trails Road <br /> 
 
       Zephyr, CA 95555<br /><br /> 
 
       888-555-5555<br /> 
 
      </div> 
 

 
      </main> 
 

 
      <footer> 
 
      Copyright &copy; 2016 Pacific Trails Resort <br /> 
 
      <a href = "mailto:[email protected]">[email protected]</a> 
 
      </footer> 
 
     </div> 
 
    </body> 
 
</html>

Répondre

0

Eh bien, il se révèle m'a donné les mauvaises images pour l'affectation. Avec les bonnes images, ils se révèlent comme prévu. Vérifiez toujours les dimensions, la hauteur et la largeur des images.