2015-08-30 65 views
0

我是一個新手網頁設計師,我需要一些幫助。 請參閱下面的html/css代碼。 該頁面應占用視口的100%。它只是有點太大。不知道爲什麼會發生這種情況。無論視口大小如何,它總是有一點點剩餘。任何輸入讚賞!窗口仍然有水平滾動

<!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> 
<style> 
@font-face { 
    font-family: "Chaparral"; 
    src: url(fonts/ChaparralPro-Regular.otf); 
} 

body { margin:0; /* This is used to reset any browser-default margins */ } 

.container { 
    width:100vw; 
    height: 1000px; 
    background-image:url(images/backgrounds/universal-background.gif); 
    background-repeat: repeat; 
} 

#title { 
    font-size: 15pt; 
    text-transform: uppercase; 
    letter-spacing: 4px; 
    display: inline; 
} 

ul { 
    float: left; 
    display: inline; 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    float: right; 
} 

li { 
    display: inline; 
    padding: 15px; 
} 

.header { 
    background-color: #403737; 
    color: white; 
    font-family: "Chaparral"; 
    font-weight: normal; 
    height: 100px;} 
</style> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 

<body> 
<div class="container"> 
    <div class="header"> 
     <h1 id="title">Risch's Jewelry Emporium</h1> 
     <ul> 
      <li>Sales</li> 
      <li>Repair</li> 
      <li>Learn</li> 
      <li>Contact</li> 
     </ul> 
    </div> 
</div> 
</body> 
</html> 

回答

2

你應該在.container標籤,而不是vw施膠性使用width:100%vw指定也包含滾動條的總視區。

.container { 
    width:100%; 
    height: 1000px; 
    background-image:url(images/backgrounds/universal-background.gif); 
    background-repeat: repeat; 
}