Can some one tell me how I can center my layout which I have made from photoshop so that no matter what resolution the
viewer's on, the layout is always displayed centered.
viewer's on, the layout is always displayed centered.
| Code: |
|
.centeredImage { text-align:center; margin-top:0px; margin-bottom:0px; padding:0px;} |
| Code: |
|
<p class="centeredImage"><img src="images/heading.gif" height="217" width="524" alt="Precise Translations" /> </p> |
| Code: |
|
<table align="center" width="800" border="0"> <tr> <td> PUT IT IN HERE TO START WITH. </td> </tr></table> |
| Code: |
|
#container{ margin-left: auto; margin-right: auto; width: 800px; border: 1px solid #000000; } |
| Code: |
|
<div id="container"> PUT IT HERE. </div> |
| Code: |
| #container{
margin:0 auto; /* this means 0 on top and bottom, and auto on left and right */ width: 800px; border: 1px solid #000; } |
| ncwdavid wrote: | ||||||
If you are using tables then put in one big table and then lots of other ones if needed:
If you are using CSS then put in all in one div and then lots of different ones inside that:
Then inside the HTML just do:
Something like that. Just change the width and add the height if you need to. Goodluck. |
| Code: |
|
<div id="image_container"><img src="http://myimage.frih.net"></div> |
| Code: |
|
body { margin: 0 0 0 0; padding: 0 0 0 0; } |
| Code: |
|
#image_container { position: relative; left: 50%; //this sets the left egde of your image at the exact half of the page margin-left: -half_of_your_images_width)px; //and now we set the image centered vertically top: 50%; margin-top: -(half_of_your_image_height)px; } |
| Code: |
| <html>
<div id="container"> <head> <title>Xtra Gfx</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- ImageReady Styles (xtragfx.psd) --> <style type="text/css"> <!-- body { background-color: #2e2d2d; background-image: url(main_bg.gif); background-repeat: repeat-y; } #container{ margin-left: auto; margin-right: auto; width: 800px; border: 1px solid #000000; } #Table_01 { position:absolute; left:0px; top:0px; width:800px; height:800px; } #xtra-gfx-a { position:absolute; left:0px; top:0px; width:109px; height:800px; } #xtra-gfx-b { position:absolute; left:109px; top:0px; width:593px; height:132px; } #xtra-gfx-c { position:absolute; left:702px; top:0px; width:98px; height:800px; } #xtra-gfx-d { position:absolute; left:109px; top:132px; width:31px; height:47px; } #xtra-gfx-e { position:absolute; left:140px; top:132px; width:91px; height:47px; } #xtra-gfx-f { position:absolute; left:231px; top:132px; width:110px; height:47px; } #xtra-gfx-g { position:absolute; left:341px; top:132px; width:109px; height:47px; } #xtra-gfx-h { position:absolute; left:450px; top:132px; width:108px; height:47px; } #xtra-gfx-i { position:absolute; left:558px; top:132px; width:111px; height:47px; } #xtra-gfx-j { position:absolute; left:669px; top:132px; width:33px; height:47px; } #xtra-gfx-k { position:absolute; left:109px; top:179px; width:593px; height:19px; } #xtra-gfx-l { position:absolute; left:109px; top:198px; width:17px; height:576px; } #xtra-gfx-m { position:absolute; left:126px; top:198px; width:230px; height:89px; background-image: url(images/xtra-gfx-m.gif); } #xtra-gfx-n { position:absolute; left:297px; top:198px; width:60px; height:105px; } #xtra-gfx-o { position:absolute; left:357px; top:198px; width:335px; height:89px; background-image: url(images/xtra-gfx-o.gif); } #xtra-gfx-p { position:absolute; left:692px; top:198px; width:10px; height:576px; } #xtra-gfx-q { position:absolute; left:126px; top:287px; width:171px; height:16px; } #xtra-gfx-r { position:absolute; left:357px; top:287px; width:335px; height:16px; } #xtra-gfx-s { position:absolute; left:126px; top:303px; width:566px; height:471px; background-image: url(images/xtra-gfx-s.gif); } #xtra-gfx-t { position:absolute; left:109px; top:774px; width:593px; height:26px; background-image: url(images/xtra-gfx-t.gif); } .style1 {color: #FFFFFF} .style2 {color: #ECE9D8} #element { text-align:left; background-color:#000; color:#FFF; width:770px; height:50px; } --> </style> <!-- End ImageReady Styles --> </head> <body style="background-color:#2e2d2d; margin-top: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto;"> <div id="layout"> <div id="element"> <!-- ImageReady Slices (xtragfx.psd) --> <div id="Table_01"> <div id="xtra-gfx-a"> <img src="images/xtra-gfx-a.gif" width="109" height="800" alt=""> </div> <div id="xtra-gfx-b"> <img src="images/xtra-gfx-b.gif" width="593" height="132" alt=""> </div> <div id="xtra-gfx-c"><img src="images/xtra-gfx-c.gif" width="98" height="800" alt=""></div> <div id="xtra-gfx-d"> <img src="images/xtra-gfx-d.gif" width="31" height="47" alt=""> </div> <div id="xtra-gfx-e"> <a href="http://xtragfx.uni.cc"><img src="images/xtra-gfx-e.gif" alt="" width="91" height="47" border="0"></a> </div> <div id="xtra-gfx-f"> <a href="http://xtragfx.uni.cc/forums/"><img src="images/xtra-gfx-f.gif" alt="" width="110" height="47" border="0"></a> </div> <div id="xtra-gfx-g"> <a href="http://"><img src="images/xtra-gfx-g.gif" alt="" width="109" height="47" border="0"></a> </div> <div id="xtra-gfx-h"> <a href="http://www.xtragfx.uni.cc/contact.php"><img src="images/xtra-gfx-h.gif" alt="" width="108" height="47" border="0"></a> </div> <div id="xtra-gfx-i"> <a href="http://www.xtragfx.uni.cc/forums/member.php?action=register"><img src="images/xtra-gfx-i.gif" alt="" width="111" height="47" border="0"></a> </div> <div id="xtra-gfx-j"> <img src="images/xtra-gfx-j.gif" width="33" height="47" alt=""> </div> <div id="xtra-gfx-k"> <img src="images/xtra-gfx-k.gif" width="593" height="19" alt=""> </div> <div id="xtra-gfx-l"> <img src="images/xtra-gfx-l.gif" width="17" height="576" alt=""> </div> <div id="xtra-gfx-m"> <p class="style1"><?php if($mybb->user['uid']) { // The user is logged in, say Hi echo "Welcome thanks for logging in ! " .$mybb->user['username']; } else { // The user is not logged in, Display the form echo "<form action='forums/member.php' method='post'> Username: <input type='text' name='username' size='20' maxlength='30' /><br /> Password: <input type='password' name='password' size='20' /> <input type='hidden' name='action' value='do_login'> <input type='hidden' name='url' value='index.php' /> <input type='submit' class='submit' name='submit' value='Login' /></form><br>"; } ?> </p> </div> <div id="xtra-gfx-n"> <img src="images/xtra-gfx-n.gif" width="60" height="105" alt=""> </div> <div class="style1" id="xtra-gfx-o"></div> <div id="xtra-gfx-p"> <img src="images/xtra-gfx-p.gif" width="10" height="576" alt=""> </div> <div id="xtra-gfx-q"> <img src="images/xtra-gfx-q.gif" width="171" height="16" alt=""> </div> <div id="xtra-gfx-r"> <img src="images/xtra-gfx-r.gif" width="335" height="16" alt=""> </div> <div id="xtra-gfx-s"></p> <p class="style1">Welcome to xtragfx , we are currently under consrtuction <span class="style1"> </span></p> </div> <div id="xtra-gfx-t"> <p class="style1">© 2006-2007 Xtra Gfx<br> Affiliates : <a href="http://www.intutorials.com/" class="style1">Intutorials</a></p> </div> </div> </div><!--end element--> </div> <!-- End ImageReady Slices --> </body> </div> </html> |
| Code: |
|
<html> <head> <title>Xtra Gfx</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- ImageReady Styles (xtragfx.psd) --> <style type="text/css"><!-- body { background-color: #2e2d2d; background-image: url(main_bg.gif); background-repeat: repeat-y; margin: 0 0 0 0; padding: 0 0 0 0; } #layout{ position: relative; width: 800px; left: 50%; margin-left: -400px; } #Table_01 { position:absolute; left:0px; top:0px; width:800px; height:800px; } #xtra-gfx-a { position:absolute; left:0px; top:0px; width:109px; height:800px; } #xtra-gfx-b { position:absolute; left:109px; top:0px; width:593px; height:132px; } #xtra-gfx-c { position:absolute; left:702px; top:0px; width:98px; height:800px; } #xtra-gfx-d { position:absolute; left:109px; top:132px; width:31px; height:47px; } #xtra-gfx-e { position:absolute; left:140px; top:132px; width:91px; height:47px; } #xtra-gfx-f { position:absolute; left:231px; top:132px; width:110px; height:47px; } #xtra-gfx-g { position:absolute; left:341px; top:132px; width:109px; height:47px; } #xtra-gfx-h { position:absolute; left:450px; top:132px; width:108px; height:47px; } #xtra-gfx-i { position:absolute; left:558px; top:132px; width:111px; height:47px; } #xtra-gfx-j { position:absolute; left:669px; top:132px; width:33px; height:47px; } #xtra-gfx-k { position:absolute; left:109px; top:179px; width:593px; height:19px; } #xtra-gfx-l { position:absolute; left:109px; top:198px; width:17px; height:576px; } #xtra-gfx-m { position:absolute; left:126px; top:198px; width:230px; height:89px; background-image: url(images/xtra-gfx-m.gif); } #xtra-gfx-n { position:absolute; left:297px; top:198px; width:60px; height:105px; } #xtra-gfx-o { position:absolute; left:357px; top:198px; width:335px; height:89px; background-image: url(images/xtra-gfx-o.gif); } #xtra-gfx-p { position:absolute; left:692px; top:198px; width:10px; height:576px; } #xtra-gfx-q { position:absolute; left:126px; top:287px; width:171px; height:16px; } #xtra-gfx-r { position:absolute; left:357px; top:287px; width:335px; height:16px; } #xtra-gfx-s { position:absolute; left:126px; top:303px; width:566px; height:471px; background-image: url(images/xtra-gfx-s.gif); } #xtra-gfx-t { position:absolute; left:109px; top:774px; width:593px; height:26px; background-image: url(images/xtra-gfx-t.gif); } .style1 { color: #FFFFFF } .style2 { color: #ECE9D8 } #element { text-align:left; background-color:#000; color:#FFF; width:770px; height:50px; } --></style> <!-- End ImageReady Styles --> </head> <body> <div id="layout"> <div id="element"> <!-- ImageReady Slices (xtragfx.psd) --> <div id="Table_01"> <div id="xtra-gfx-a"> <img src="images/xtra-gfx-a.gif" width="109" height="800" alt=""> </div> <div id="xtra-gfx-b"> <img src="images/xtra-gfx-b.gif" width="593" height="132" alt=""> </div> <div id="xtra-gfx-c"><img src="images/xtra-gfx-c.gif" width="98" height="800" alt=""></div> <div id="xtra-gfx-d"> <img src="images/xtra-gfx-d.gif" width="31" height="47" alt=""> </div> <div id="xtra-gfx-e"> <a href="http://xtragfx.uni.cc"><img src="images/xtra-gfx-e.gif" alt="" width="91" height="47" border="0"></a> </div> <div id="xtra-gfx-f"> <a href="http://xtragfx.uni.cc/forums/"><img src="images/xtra-gfx-f.gif" alt="" width="110" height="47" border="0"></a> </div> <div id="xtra-gfx-g"> <a href="http://"><img src="images/xtra-gfx-g.gif" alt="" width="109" height="47" border="0"></a> </div> <div id="xtra-gfx-h"> <a href="http://www.xtragfx.uni.cc/contact.php"><img src="images/xtra-gfx-h.gif" alt="" width="108" height="47" border="0"></a> </div> <div id="xtra-gfx-i"> <a href="http://www.xtragfx.uni.cc/forums/member.php?action=register"><img src="images/xtra-gfx-i.gif" alt="" width="111" height="47" border="0"></a> </div> <div id="xtra-gfx-j"> <img src="images/xtra-gfx-j.gif" width="33" height="47" alt=""> </div> <div id="xtra-gfx-k"> <img src="images/xtra-gfx-k.gif" width="593" height="19" alt=""> </div> <div id="xtra-gfx-l"> <img src="images/xtra-gfx-l.gif" width="17" height="576" alt=""> </div> <div id="xtra-gfx-m"> <p class="style1"><?php if($mybb->user['uid']) { // The user is logged in, say Hi echo "Welcome thanks for logging in ! " .$mybb->user['username']; } else { // The user is not logged in, Display the form echo "<form action='forums/member.php' method='post'> Username: <input type='text' name='username' size='20' maxlength='30' /><br /> Password: <input type='password' name='password' size='20' /> <input type='hidden' name='action' value='do_login'> <input type='hidden' name='url' value='index.php' /> <input type='submit' class='submit' name='submit' value='Login' /></form><br>"; } ?> </p> </div> <div id="xtra-gfx-n"> <img src="images/xtra-gfx-n.gif" width="60" height="105" alt=""> </div> <div class="style1" id="xtra-gfx-o"></div> <div id="xtra-gfx-p"> <img src="images/xtra-gfx-p.gif" width="10" height="576" alt=""> </div> <div id="xtra-gfx-q"> <img src="images/xtra-gfx-q.gif" width="171" height="16" alt=""> </div> <div id="xtra-gfx-r"> <img src="images/xtra-gfx-r.gif" width="335" height="16" alt=""> </div> <div id="xtra-gfx-s"></p> <p class="style1">Welcome to xtragfx , we are currently under consrtuction <span class="style1"> </span></p> </div> <div id="xtra-gfx-t"> <p class="style1">� 2006-2007 Xtra Gfx<br> Affiliates : <a href="http://www.intutorials.com/" class="style1">Intutorials</a></p> </div> </div> </div><!--end element--> </div> <!-- End ImageReady Slices --> </body> </html> |
| Code: |
| <html>
<head> <title>Xtra Gfx</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- ImageReady Styles (xtragfx.psd) --> <style type="text/css"><!-- body { background-color: #2e2d2d; margin: 0 0 0 0; padding: 0 0 0 0; } #layout{ position: relative; width: 800px; left: 50%; margin-left: -400px; background-image: url(main_bg.gif); background-repeat: repeat-y; } #Table_01 { position:absolute; left:0px; top:0px; width:800px; height:800px; } #xtra-gfx-a { position:absolute; left:0px; top:0px; width:109px; height:800px; } #xtra-gfx-b { position:absolute; left:109px; top:0px; width:593px; height:132px; } #xtra-gfx-c { position:absolute; left:702px; top:0px; width:98px; height:800px; } #xtra-gfx-d { position:absolute; left:109px; top:132px; width:31px; height:47px; } #xtra-gfx-e { position:absolute; left:140px; top:132px; width:91px; height:47px; } #xtra-gfx-f { position:absolute; left:231px; top:132px; width:110px; height:47px; } #xtra-gfx-g { position:absolute; left:341px; top:132px; width:109px; height:47px; } #xtra-gfx-h { position:absolute; left:450px; top:132px; width:108px; height:47px; } #xtra-gfx-i { position:absolute; left:558px; top:132px; width:111px; height:47px; } #xtra-gfx-j { position:absolute; left:669px; top:132px; width:33px; height:47px; } #xtra-gfx-k { position:absolute; left:109px; top:179px; width:593px; height:19px; } #xtra-gfx-l { position:absolute; left:109px; top:198px; width:17px; height:576px; } #xtra-gfx-m { position:absolute; left:126px; top:198px; width:230px; height:89px; background-image: url(images/xtra-gfx-m.gif); } #xtra-gfx-n { position:absolute; left:297px; top:198px; width:60px; height:105px; } #xtra-gfx-o { position:absolute; left:357px; top:198px; width:335px; height:89px; background-image: url(images/xtra-gfx-o.gif); } #xtra-gfx-p { position:absolute; left:692px; top:198px; width:10px; height:576px; } #xtra-gfx-q { position:absolute; left:126px; top:287px; width:171px; height:16px; } #xtra-gfx-r { position:absolute; left:357px; top:287px; width:335px; height:16px; } #xtra-gfx-s { position:absolute; left:126px; top:303px; width:566px; height:471px; background-image: url(images/xtra-gfx-s.gif); } #xtra-gfx-t { position:absolute; left:109px; top:774px; width:593px; height:26px; background-image: url(images/xtra-gfx-t.gif); } .style1 { color: #FFFFFF } .style2 { color: #ECE9D8 } #element { text-align:left; background-color:#000; color:#FFF; width:770px; height:50px; } --></style> <!-- End ImageReady Styles --> </head> <body> <div id="layout"> <div id="element"> <!-- ImageReady Slices (xtragfx.psd) --> <div id="Table_01"> <div id="xtra-gfx-a"> <img src="images/xtra-gfx-a.gif" width="109" height="800" alt=""> </div> <div id="xtra-gfx-b"> <img src="images/xtra-gfx-b.gif" width="593" height="132" alt=""> </div> <div id="xtra-gfx-c"><img src="images/xtra-gfx-c.gif" width="98" height="800" alt=""></div> <div id="xtra-gfx-d"> <img src="images/xtra-gfx-d.gif" width="31" height="47" alt=""> </div> <div id="xtra-gfx-e"> <a href="http://xtragfx.uni.cc"><img src="images/xtra-gfx-e.gif" alt="" width="91" height="47" border="0"></a> </div> <div id="xtra-gfx-f"> <a href="http://xtragfx.uni.cc/forums/"><img src="images/xtra-gfx-f.gif" alt="" width="110" height="47" border="0"></a> </div> <div id="xtra-gfx-g"> <a href="http://"><img src="images/xtra-gfx-g.gif" alt="" width="109" height="47" border="0"></a> </div> <div id="xtra-gfx-h"> <a href="http://www.xtragfx.uni.cc/contact.php"><img src="images/xtra-gfx-h.gif" alt="" width="108" height="47" border="0"></a> </div> <div id="xtra-gfx-i"> <a href="http://www.xtragfx.uni.cc/forums/member.php?action=register"><img src="images/xtra-gfx-i.gif" alt="" width="111" height="47" border="0"></a> </div> <div id="xtra-gfx-j"> <img src="images/xtra-gfx-j.gif" width="33" height="47" alt=""> </div> <div id="xtra-gfx-k"> <img src="images/xtra-gfx-k.gif" width="593" height="19" alt=""> </div> <div id="xtra-gfx-l"> <img src="images/xtra-gfx-l.gif" width="17" height="576" alt=""> </div> <div id="xtra-gfx-m"> <p class="style1"><?php if($mybb->user['uid']) { // The user is logged in, say Hi echo "Welcome thanks for logging in ! " .$mybb->user['username']; } else { // The user is not logged in, Display the form echo "<form action='forums/member.php' method='post'> Username: <input type='text' name='username' size='20' maxlength='30' /><br /> Password: <input type='password' name='password' size='20' /> <input type='hidden' name='action' value='do_login'> <input type='hidden' name='url' value='index.php' /> <input type='submit' class='submit' name='submit' value='Login' /></form><br>"; } ?> </p> </div> <div id="xtra-gfx-n"> <img src="images/xtra-gfx-n.gif" width="60" height="105" alt=""> </div> <div class="style1" id="xtra-gfx-o"></div> <div id="xtra-gfx-p"> <img src="images/xtra-gfx-p.gif" width="10" height="576" alt=""> </div> <div id="xtra-gfx-q"> <img src="images/xtra-gfx-q.gif" width="171" height="16" alt=""> </div> <div id="xtra-gfx-r"> <img src="images/xtra-gfx-r.gif" width="335" height="16" alt=""> </div> <div id="xtra-gfx-s"></p> <p class="style1">Welcome to xtragfx , we are currently under consrtuction <span class="style1"> </span></p> </div> <div id="xtra-gfx-t"> <p class="style1">� 2006-2007 Xtra Gfx<br> Affiliates : <a href="http://www.intutorials.com/" class="style1">Intutorials</a></p> </div> </div> </div><!--end element--> </div> <!-- End ImageReady Slices --> </body> </html> |
| Code: |
|
margin:0 auto; |
| Code: |
|
div#wrapper { margin: 0 auto; } |
| Code: |
|
<div id="wrapper"> content </div> |