Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
good
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <style type="text/css">
.fixedSize
{
    width:1024px;
    height:768px;
    /* use the below to centre the div */
    margin-left:auto;
    margin-right:auto;
    /* set the background to red so we can see the div */
    background:#ff0000;
}
</style>
</head>
<body>
<div class="fixedSize">
<p>Fixed Size!</p>
</div>
</body>
</html>
  Permalink  
v2
Comments
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!
--SA
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 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 24 Oct 2011
Copyright © CodeProject, 1999-2014
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