Click here to Skip to main content
11,928,987 members (56,470 online)
Rate this:
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 23: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 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 24-Oct-11 5:46am
No probs, I've updated the solution with an example, centralized 1024x768 div.
SAKryukov 24-Oct-11 20:57pm
Good solution of centralized; this is a subtle topic. My 5!
Chiranthaka Sampath 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.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