Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

John Levy
1,451 PointsHow to position a image anywhere on the page
I am having trouble positioning a image further down the page. Right now it ends up pushing the rest of the content down the page and it stays in the top left hand corner. How can I position the image anywhere on the page? Thanks in advance.
6 Answers

John Levy
1,451 PointsThanks that worked.

Idan Melamed
16,285 PointsCan you post your css and html?

John Levy
1,451 PointsHi, I have attached the html and CSS. As you can see the image just pushes the rest of the text down rather than the image being at the bottom of the page. HTML- <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>navbar</title> <link rel="stylesheet" href="style.css"> <link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<div id="rectangle">
</div>
<div id="rectangle2">
</div>
<div id="rectangle3">
</div>
<div id="blueline">
</div>
<div>
<img src="beginnerimage.jpg" alt="">
</div>
</head> <body> <ul class="nav"> <li><a href="#">PERSONAL/ONLINE TRAINING</a></li> <li><a href="#">EBOOKS</a></li> <li><a href="#">INSTAGRAM SHOUTOUTS</a></li> <li><a href="#">APPS</a></li> <li><a href="#">PRODUCTS</a></li> </ul>
<ul class="options"> <li><a href="#">BEGINNER</a></li> <li><a href="#">ADVANCED</a></li> <li><a href="#">BUNDLE</a></li> </ul>
<h1>BEGIN YOUR JOURNEY</h1>
<h2>WITH BEACH BODY ABS HERE</h2>
<h3>TIGHTEN UP YOUR MIDSECTION</h3>
<h4>INCREASE YOUR ENERGY</h4>
<h5>FEEL AND LOOK BETTER</h5>
</body> </html>
CSS- body { margin:0; padding: 0; font-family: 'Roboto', serif; }
.nav { background-color: white; color: white; list-style: none; /gets rid of bullet points/ text-align: center; padding: 0px 0 100px 0; font-size: 30px; }
.nav > li { display:Inline-block; padding-right: 50px; }
.nav > li a { text-decoration: none; color: blue; }
.nav > li > a:hover { color: black; }
}
#rectangle { border: 5px 15px grey solid; background-color: #847bf7; height: 50px; width: 250px; position: absolute; top: 150px; left: 200px; } #rectangle2 { border: 5px black; background-color: black; height: 50px; width: 250px; position: absolute; top: 150px; left: 700px; }
#rectangle3 { border: 5px black; background-color: #847bf7; height: 102px; width: 430px; position: absolute; top: 253px; left: 5px; }
#blueline {
background-color: #847bf7;
height: 0px;
width: 830px;
position: absolute;
top: 40px;
padding: 5px 0 5px 0;
margin: 560px 250px 0;
}
.options { border: 5px solid blue;
color: white;
list-style: none; /*gets rid of bullet points*/
text-align: center;
padding: 0px 0 0px 0;
}
.options > li { display:Inline-block; padding: 20px; padding-right: 140px; }
.options > li a { text-decoration: none; color: blue; font-size: 50px; }
h1, h2,h3,h4,h5 { Font-family: 'Roboto', serif; }
h1 {
font-size: 80px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 6px 0 0;
padding-top: 40px;
}
h2{
font-size: 55px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 0px 0 0;
padding-top: 0px;
}
h2{
font-size: 45px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 20px 0 0;
padding-top: 20px;
}
h3{
font-size: 25px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 10px 0 0;
padding-top: 10px;
padding-bottom: -20px;
}
h4{
font-size: 25px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 5px 0 0;
padding-top: -20px;
padding-bottom: -20px;
}
h5{
font-size: 25px;
color: #847bf7;
text-transform: uppercase;
font-weight: normal;
line-height: 1.3;
text-align: center;
margin: 5px 0 0;
padding-top: -20px;
}
img { max-width: 100%; }

Idan Melamed
16,285 PointsKind of hard to understand the code... Can you edit it like this?
put your html here
put your css here

Idan Melamed
16,285 PointsOne this I can say in advance... In your html file, try placing the image after the <h5> tag

John Levy
1,451 PointsHi, I placed the image under the <h5> tag and it brought the image to the bottom of the page so thanks for that. I am still having trouble moving the image exactly where I want tit under the text. I attached the HTML5 and CSS code below. Thanks in advance. HTML5- <div> <img src="beginnerimage.jpg" alt=""> </div
CSS- img { max-width: 50%; margin:0px; margin-top: 20px; }