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 trialJeyhun Guliyev
Courses Plus Student 490 Pointswhy my page gets messed up?
why my page gets messed up when I zoom in and out the page? 1st div goes to the right and second to the left?
Jeyhun Guliyev
Courses Plus Student 490 Points@Kamran, what about theory, in theory why this happens? you zoom in/out everything get spread around and messy
3 Answers
Lee Ravenberg
10,018 PointsWhen you zoom in, and out with your browser, the position relative positioned elements may differ. If you have an example of your code we may be able to verify.
Jeyhun Guliyev
Courses Plus Student 490 Points<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome</title>
<style> body { background: grey; }
logos {
width: 1100px;
height: 500px;
margin: 0 auto;
}
list {
width: 150px;
height: 150px;
position:absolute;
top: 100px;
margin: 25px;
} </style>
</head>
<body>
<div id="logos"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/World_location_map.svg/1100px-World_location_map.svg.png"/></div>
<div class="country">
<div id="list">
<a href="#"><img src="http://grupo-colibri.com/eng/images/usa_american_united_states_us_flag3.png" /></a>
<a href="#"><img src="http://vignette2.wikia.nocookie.net/gasmaskandrespirator/images/2/2b/Poland_polish_flag-1-.png/revision/latest?cb=20140819213154"/></a>
</div>
</div>
</body>
</html>
Lee Ravenberg
10,018 PointsThanks for posting your code, I have made a file to reproduce this:
<!DOCTYPE html>
<html>
<head>
<title>something</title>
<style>
body { background: grey; }
#list {
width: 150px;
height: 150px;
position:absolute;
top: 100px;
margin: 25px;
}
</style>
</head>
<body>
<div class="country">
<div id="list">
<a href="#"><img src="http://grupo-colibri.com/eng/images/usa_american_united_states_us_flag3.png" /> </a>
<a href="#"><img src="http://vignette2.wikia.nocookie.net/gasmaskandrespirator/images/2/2b/Poland_polish_flag-1-.png/revision/latest?cb=20140819213154"/></a>
</div>
</div>
</body>
</html>
However, when I zoom in and out with my browser, the flags stay aligned vertically. I dont see the problem.
Jeyhun Guliyev
Courses Plus Student 490 PointsThanks mate. However, why they basically go to different sides, i mean sometimes divs, images, texts do not remain in the center. This is because I use position: relative or absolute?
Kamran Ismayilov
5,753 PointsKamran Ismayilov
5,753 PointsHi, I need to see your code if you want to get help)