PDA

View Full Version : Page Not Centered?


youdw
05-21-2010, 04:01 PM
I created all my webpages and thought they were all centered until I got a larger LCD screen and when I loaded my webpages again, everything was lined to the left side. How do I get it to look centered on screen no matter what screen size?

domedia
05-21-2010, 04:38 PM
You just need to center it properly.
It's hard to tell what you're not doing right though.

We have a tutorial here:
http://www.dreamweaverclub.com/css-center-content.php

If you need further help, you'll need to provide a URL.

.

youdw
05-21-2010, 07:35 PM
Can you help me by figuring how to center the page with this code out?

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>as</title>
<script type="text/JavaScript">
<!--



function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<link href="../CSS.css" rel="stylesheet" type="text/css" />
</head>


<table width="1194" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>

<td><!--DWLayoutEmptyCell-->&nbsp;</td>
<td><div align="left"></div></td>
</tr>
<tr>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><p align="center"><a href="model01.html"><img src="../Website_Images/Front Page/Front Image.jpg" alt="Classical Bedroom" width="800" height="600" border="0" /></a></p>
<p align="center"><strong><img src=".jpg" width="374" height="150" /></strong></p>
<!-- #BeginLibraryItem "/Library/copyright.lbi" -->
<p align="center" class="style5"><em>&copy;</em></p>

<!-- #EndLibraryItem --><p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<h1 align="center">&nbsp;</h1> </td>
</tr>
</table>
<p align="center">&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

Corrosive
05-22-2010, 08:02 AM
Should be...

HTML

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>as</title>
<script type="text/JavaScript">
<!--



function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<link href="../CSS.css" rel="stylesheet" type="text/css" />
</head>

<div id="wrapper">
<table width="1194" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>

<td><!--DWLayoutEmptyCell-->&nbsp;</td>
<td><div align="left"></div></td>
</tr>
<tr>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><p align="center"><a href="model01.html"><img src="../Website_Images/Front Page/Front Image.jpg" alt="Classical Bedroom" width="800" height="600" border="0" /></a></p>
<p align="center"><strong><img src=".jpg" width="374" height="150" /></strong></p>
<!-- #BeginLibraryItem "/Library/copyright.lbi" -->
<p align="center" class="style5"><em>&copy;</em></p>

<!-- #EndLibraryItem --><p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<h1 align="center">&nbsp;</h1> </td>
</tr>
</table>
<p align="center">&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</body>
</html>

CSS (assuming in an external stylesheet)

#wrapper {width: 1194px; margin: 0 auto;}

I have assumed a width of 1194 as that is the width of your main table but change it to suit.

I'd also look at using divs and CSS for your layout instead of tables (for many reasons we've gone into many times before on this forum). Also, you need to get rid of all those empty tags to clean up your HTML.