Click here to Skip to main content
11,805,604 members (55,820 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: HTML XHTML web-dev
If I want to have the same size or screen resolution as 1024 * 768 for all my html pages how can I do that?
Posted 23-Oct-11 22:08pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Contain the page content in a div and set the width and height to 1024 by 768 pixels.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
    <title>Untitled Page</title>
    <style type="text/css">
    /* use the below to centre the div */
    /* set the background to red so we can see the div */
<div class="fixedSize">
<p>Fixed Size!</p>
Chiranthaka Sampath at 24-Oct-11 5:14am
I tried this but it does not work as I wish!.Give me some sample code for this please!
Dave Kerr at 24-Oct-11 5:46am
No probs, I've updated the solution with an example, centralized 1024x768 div.
SAKryukov at 24-Oct-11 20:57pm
Good solution of centralized; this is a subtle topic. My 5!
Chiranthaka Sampath at 25-Oct-11 4:20am
I tried this but face a trouble that when I set the width to 1024 the window came restored down. But when the page maximized the web page does not centered. Please kind to solve this!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 310
1 Richard Deeming 225
2 Sergey Alexandrovich Kryukov 170
3 Abhinav S 128
4 ppolymorphe 125
0 OriginalGriff 3,300
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 24 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100