When I zoom out of the pages which I've created for my website, it seems that as you zoom out the pages move towards the left, although the content stays where it is supposed to be. But when I zoom out of website such as this the page stays in the center. How do I achieve this on my wepages?

Recommended Answers

It depends on how you have defined margins and that sort of thing. You probably can't get much of an answer unless you post some code / css or provide a link to the page.

Jump to Post

When I zoom out of the pages which I've created for my website, it seems that as you zoom out the pages move towards the left, although the content stays where it is supposed to be. But when I zoom out of website such as this the page stays in …

Jump to Post

try:

.contet { width: 90%; margin: 0 auto; }

Jump to Post

All 9 Replies

It depends on how you have defined margins and that sort of thing. You probably can't get much of an answer unless you post some code / css or provide a link to the page.

I have defined most of it with px but the body has been defined by percentage i.e.

body {
position:absolute;
margin-left:10%;
margin-right:10%;
margin-top:0%;
background-color:#b3b3b3;
}

When I zoom out of the pages which I've created for my website, it seems that as you zoom out the pages move towards the left, although the content stays where it is supposed to be. But when I zoom out of website such as this the page stays in the center. How do I achieve this on my wepages?

body { width:100%; text-align:center;}
.content {width:90%; text-align:left;}

<!--dtd head etc--> <body> <div class='content'>bla bla bla</div> </body></html>[code=html]<!--dtd head etc-->
<body>
<div class='content'>bla bla bla</div>
</body></html>

That didn't do anything :(

try:

.contet { width: 90%; margin: 0 auto; }

Arghh that still didn't work^^!
It's so annoying. any more suggestions?

*waits impatiently*

I think it looks like it moves because you use percentages, and when you zoom out the percentage the div takes out of the page grows.
Just a thought

You sure that you've already DTD in your markup ? Without DTD, 'margin: auto' will not work on IE.

Anyway, we can't know what's really going wrong if you don't post any codes. Post some codes or provide the link here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.