2017-02-15 57 views
0

我收到了一些關於過去作業的反饋,警告我關於我的圖像模糊。但我無法弄清楚如何解決它。該任務給出了非常清晰的描述,但我做了所有要求的事情。如何修復使用CSS呈現時模糊的圖像?

我必須做的圖像以下:

添加一個名爲yurthero一個新的選擇ID。在CSS代碼聲明中配置300px高度並顯示coast.jpg背景圖像以填充空間(使用background-size:100%100%;)而不重複。

如何阻止我的圖像模糊?在我看來,拉伸迫使它模糊。

下面附加的是html5,css3和我正在使用的圖像。 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>

回答

0

那麼它原來我給出了分配錯誤的圖片。有了正確的照片,他們按照預期打開了。始終檢查圖像上的尺寸,高度和寬度尺寸。