0

When I implemented the background in CSS, it covered the whole page but the length wasn't big enough to cover the content I wanted to write in it. I researched and found a background repeat-y, which I thought would copy the background again, making the page longer. When I code background-repeat: y; } into CSS, it gives me the length I wanted, but splits the background so it doesn't cover the whole page. Most of it is white. What am I doing wrong? Thanks.

HTML:

<!DOCTYPE html>
<html>
<head>

<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="aboutme.css">
<title>It's all about me!</title>
</head>
<body>
<div id="content">
<header>
<div class="grow">
<ul>
  <li><a href="index.html">Home</a></li>
  <li><a href="aboutme.html">About me</a></li>
  <li><a href="like.html">What I love</a></li>
</ul>
</div>
</header>
<h1>About Me</h1>
<img src="ben.jpg" id="ben">
<b><h2>The beginning of coding:</h2></b>
<img src="runescape.jpg">
</div>
<p></p>
</body>
</html>

CSS:

body {
    background-image: url(halftone.png);
    background-repeat: repeat-y;
    width: 1000px;
    height: 4000px;

}
h1 { font-family: 'Lobster', cursive;

    color: black;
    position: absolute;
    top: 25px;
    left: 540px;
    text-decoration: underline;

}

h2 {font-family: 'lobster', cursive;
    color: black;
    position: absolute;
    top: 540px;
    left: 480px;
    text-decoration: underline;

}
p { font-family: 'Lobster', cursive;
    font-size: 20px;
    color: white;
    position: absolute;
    top: 300px;
    left: 320px;
    display: 0px auto;
}

#runescape {
    position: absolute;
    top: 500px;
}
#pagesize {
    max-height: 10000px;
}

#ben {
    position: absolute;
    top: 130px;
    left: 290px;
    width: 700px;
    height: 400px;

}
.grow {
    position: absolute;
    left: 550px;
    top: 700px;
}


a {
    color: black;
    text-decoration: none;
    font-weight: bold;
}
ul {
    padding: 10px;
    background: #dcf3ff;
    border-width: 6px;
    border-style: solid;
    border-color: white;

}

li {
    display: inline;
    padding: 0px 15px 0px 15px;
    border-right: 2px solid black;
    border-left: 2px solid black;

}

#cameron {
    position: absolute;
    top: 285px;
    left: 220px;
}

#pastcoding {
    position: absolute;
    top: 100px;
}

.grow {
  display: inline-block;
  -webkit-transition-duration: 0.7s;
  transition-duration: 0.7s;
  -webkit-transition-property: -webkit-transform;
  transition-property: transform;
  -webkit-transform: translateZ(0);
  -ms-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}

.grow:hover {
  -webkit-transform: scale(1.3);
  -ms-transform: scale(1.3);
  transform: scale(1.3);
}
AmanVirdi
  • 1,667
  • 2
  • 22
  • 32

3 Answers3

0

Try background-size:cover; to your body

Benjamin
  • 2,612
  • 2
  • 20
  • 32
0

Yeah background-size:cover; is a enough option. But may be it doesn't view your image completely as expected. Best option to accomplish your task is that the image should re-size proportional to your body size and use background-size: (width)px (height)px; in your body styling. But this is only applicable to fixed size body. Unless it won't be pretty. :-)

sajithrw
  • 73
  • 7
0

Try background-repeat: repeat; and min-height: 1080px; to body in css and change 1080px to as required to you.

piyxxx12
  • 31
  • 3