/    Sign up×
Community /Pin to ProfileBookmark

how center webpage on a 1280×1024 display?

Hi,

I want users with a 1280×1024 display to see my webpage centered on their screen (not left justified). Can I do that and still allow users with an 800X600 display to see it left justified?

Thanks!

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@HaganeNoKokoroSep 09.2005 — Put all your content inside something like this:<div style="text-align:center">
<div style="width:780px; height:600px; margin:auto; text-align:left;">
<!-- Your content Here -->
</div>
</div>
The margin:auto part centers the 780 x 600 div in good browsers (and IE6 too) while the text-align:center part centers it in bad browsers (IE5). It will only be centered if the window is bigger than 800px wide.

Since the width of the element containing all the content is 780, it will fit inside an 800 x 600 window, and appear left-justified.
Copy linkTweet thisAlerts:
@ellen4566authorSep 09.2005 — I will give that a try.
Copy linkTweet thisAlerts:
@KravvitzSep 09.2005 — [url=http://www.dynamicsitesolutions.com/css/center_element/]How to Center Elements with CSS[/url]
×

Success!

Help @ellen4566 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...