Mithrandir
Mithrandir

Reputation: 5

Window still has horizontal scroll

I'm a novice web designer and I need a bit of help. See my html/css code below. The page is supposed to take up 100% of the viewport. It is just a little bit too big. No clue why this happens. No matter what viewport size it always has a little bit leftover. Any input appreciated!

<!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>

Upvotes: 0

Views: 34

Answers (1)

Sharad Saxena
Sharad Saxena

Reputation: 319

You should use width:100% on the .container tag instead of vw sizing property. The vw specifies total viewport area which also includes scrollbars.

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

Upvotes: 2

Related Questions